Skip to content

Commit

Permalink
Fix Joystick controller range mappings for sticks
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Oct 17, 2018
1 parent c3622a5 commit 401f34d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tello.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ func jsFloatToTello(fv float64) uint64 {

func jsInt16ToTello(sv int16) uint64 {
// sv is in range -32768 to 32767, we need 660 to 1388 where 0 => 1024
return uint64((sv / 90) + 1024)
//return uint64((sv / 90) + 1024)
// Changed this as new info (Oct 18) suggests range should be 364 to 1684...
return uint64(float32(sv)/49.672 + 1024)
}

func (tello *Tello) sendStickUpdate() {
Expand Down Expand Up @@ -613,4 +615,8 @@ func (tello *Tello) sendStickUpdate() {

// send the command packet
tello.ctrlConn.Write(buff)

// log.Printf("Stick Vals: Lx: %d, Ly: %d, Rx: %d, Ry: %d - Stick packet: %x\n",
// tello.ctrlLx, tello.ctrlLy, tello.ctrlRx, tello.ctrlRy, buff)

}

0 comments on commit 401f34d

Please sign in to comment.