Skip to content

Commit

Permalink
Only log MOV position if all 3 valid flags are OK
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Sep 13, 2018
1 parent d9fde03 commit 4ca223f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions flog.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ func (tello *Tello) parseLogPacket(data []byte) {
if flags&logValidVelZ != 0 {
tello.fd.MVO.VelocityZ = -(int16(xorBuf[offset+6]) + int16(xorBuf[offset+7])<<8)
}
if flags&logValidPosY != 0 {
// if flags&logValidPosY != 0 {
// tello.fd.MVO.PositionY = bytesToFloat32(xorBuf[offset+8 : offset+13])
// }
// if flags&logValidPosX != 0 {
// tello.fd.MVO.PositionX = bytesToFloat32(xorBuf[offset+12 : offset+17])
// }
// if flags&logValidPosZ != 0 {
// tello.fd.MVO.PositionZ = bytesToFloat32(xorBuf[offset+16 : offset+21])
// }
if flags&logValidPosY != 0 && flags&logValidPosX != 0 && flags&logValidPosZ != 0 {
tello.fd.MVO.PositionY = bytesToFloat32(xorBuf[offset+8 : offset+13])
}
if flags&logValidPosX != 0 {
tello.fd.MVO.PositionX = bytesToFloat32(xorBuf[offset+12 : offset+17])
}
if flags&logValidPosZ != 0 {
tello.fd.MVO.PositionZ = bytesToFloat32(xorBuf[offset+16 : offset+21])
}
tello.fdMu.Unlock()
Expand Down

0 comments on commit 4ca223f

Please sign in to comment.