diff options
author | Keith Packard <keithp@keithp.com> | 2011-06-02 23:16:30 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-06-02 23:16:30 -0700 |
commit | dc0b49dcbaa2d0a69e002c151337b6e9fd3060d9 (patch) | |
tree | 183e7f0f027e796fa253413e4ac38a87fb05194e | |
parent | 4d27e281f81aee88adff3d84085356ec310e4b92 (diff) |
altosui: Handle old TeleDongle receiving kalman telemetry packets
The telemetry packets now send the kalman height/speed/accel values
instead of the ad-hoc values. If received by an old TeleDongle box,
the speed value will be of the form 0x8000abcd, which will be printed
as a 32-bit value by TeleDongle. We only want the abcd part, which is
the speed * 16. Detect this automatically and compute the correct
values for all three.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altosui/AltosTelemetry.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/altosui/AltosTelemetry.java b/altosui/AltosTelemetry.java index 91b6d048..7d68b5b5 100644 --- a/altosui/AltosTelemetry.java +++ b/altosui/AltosTelemetry.java @@ -326,6 +326,16 @@ public class AltosTelemetry extends AltosRecord { AltosParse.word(words[i++], "fp:"); flight_pres = AltosParse.parse_int(words[i++]); + /* Old TeleDongle code with kalman-reporting TeleMetrum code */ + if ((flight_vel & 0xffff0000) == 0x80000000) { + speed = ((short) flight_vel) / 16.0; + acceleration = flight_accel / 16.0; + height = flight_pres; + flight_vel = MISSING; + flight_pres = MISSING; + flight_accel = MISSING; + } + AltosParse.word(words[i++], "gp:"); ground_pres = AltosParse.parse_int(words[i++]); |