Skip to content

Commit

Permalink
Merge pull request hybridgroup#552 from cbwang2016/patch-6
Browse files Browse the repository at this point in the history
bug fix for DJI Tello driver
  • Loading branch information
deadprogram authored May 22, 2018
2 parents dd25fb0 + e06e6c6 commit 5c6e47a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions platforms/dji/tello/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,23 @@ type FlightData struct {
Height int16
ImuCalibrationState int8
ImuState bool
LightStrength int16
LightStrength int8
NorthSpeed int16
OutageRecording bool
PowerState bool
PressureState bool
SmartVideoExitMode int16
TemperatureHeight bool
ThrowFlyTimer int8
WifiDisturb int16
WifiStrength int16
WifiDisturb int8
WifiStrength int8
WindState bool
}

// WifiData packet returned by the Tello
type WifiData struct {
Disturb int16
Strength int16
Disturb int8
Strength int8
}

// Driver represents the DJI Tello drone
Expand Down Expand Up @@ -725,14 +725,14 @@ func (d *Driver) handleResponse() error {
msgType = (uint16(buf[6]) << 8) | uint16(buf[5])
switch msgType {
case wifiMessage:
buf := bytes.NewReader(buf[9:12])
buf := bytes.NewReader(buf[9:10])
wd := &WifiData{}
binary.Read(buf, binary.LittleEndian, &wd.Strength)
binary.Read(buf, binary.LittleEndian, &wd.Disturb)
d.Publish(d.Event(WifiDataEvent), wd)
case lightMessage:
buf := bytes.NewReader(buf[9:10])
var ld int16
buf := bytes.NewReader(buf[9:9])
var ld int8
binary.Read(buf, binary.LittleEndian, &ld)
d.Publish(d.Event(LightStrengthEvent), ld)
case logMessage:
Expand Down

0 comments on commit 5c6e47a

Please sign in to comment.