Skip to content

Commit d9061ce

Browse files
tello: Fix partially #793 by initialize doneCh in NewDriverWithIP (#931)
1 parent 8b20c45 commit d9061ce

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

platforms/dji/tello/driver.go

+2-24
Original file line numberDiff line numberDiff line change
@@ -202,30 +202,7 @@ type Driver struct {
202202
// NewDriver creates a driver for the Tello drone. Pass in the UDP port to use for the responses
203203
// from the drone.
204204
func NewDriver(port string) *Driver {
205-
d := &Driver{name: gobot.DefaultName("Tello"),
206-
reqAddr: "192.168.10.1:8889",
207-
respPort: port,
208-
videoPort: "11111",
209-
Eventer: gobot.NewEventer(),
210-
doneCh: make(chan struct{}, 1),
211-
}
212-
213-
d.AddEvent(ConnectedEvent)
214-
d.AddEvent(FlightDataEvent)
215-
d.AddEvent(TakeoffEvent)
216-
d.AddEvent(LandingEvent)
217-
d.AddEvent(PalmLandingEvent)
218-
d.AddEvent(BounceEvent)
219-
d.AddEvent(FlipEvent)
220-
d.AddEvent(TimeEvent)
221-
d.AddEvent(LogEvent)
222-
d.AddEvent(WifiDataEvent)
223-
d.AddEvent(LightStrengthEvent)
224-
d.AddEvent(SetExposureEvent)
225-
d.AddEvent(VideoFrameEvent)
226-
d.AddEvent(SetVideoEncoderRateEvent)
227-
228-
return d
205+
return NewDriverWithIP("192.168.10.1", port)
229206
}
230207

231208
// NewDriverWithIP creates a driver for the Tello EDU drone. Pass in the ip address and UDP port to use for the responses
@@ -236,6 +213,7 @@ func NewDriverWithIP(ip string, port string) *Driver {
236213
respPort: port,
237214
videoPort: "11111",
238215
Eventer: gobot.NewEventer(),
216+
doneCh: make(chan struct{}, 1),
239217
}
240218

241219
d.AddEvent(ConnectedEvent)

0 commit comments

Comments
 (0)