summaryrefslogtreecommitdiff
path: root/altosui/AltosState.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-24 05:27:57 +0900
committerKeith Packard <keithp@keithp.com>2011-03-24 05:27:57 +0900
commitf3e68341f6f5daaf26dd162e4f9a06c29988986a (patch)
tree2590305c2cc5677f190ae89f4d7ce61005d96544 /altosui/AltosState.java
parent1e976a105423f2da1842f70da531c9051ba88a7f (diff)
altosui: Add support for telemetry version 4
New telemetry format needed to support TeleNano and TeleMini Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosState.java')
-rw-r--r--altosui/AltosState.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/altosui/AltosState.java b/altosui/AltosState.java
index ec499d5a..4e165f80 100644
--- a/altosui/AltosState.java
+++ b/altosui/AltosState.java
@@ -79,7 +79,8 @@ public class AltosState {
data = cur;
ground_altitude = data.ground_altitude();
- height = data.filtered_altitude() - ground_altitude;
+ height = data.filtered_height();
+ System.out.printf("height %g\n", height);
report_time = System.currentTimeMillis();
@@ -114,10 +115,14 @@ public class AltosState {
/* compute barometric speed */
double height_change = height - prev_state.height;
- if (time_change > 0)
- baro_speed = (prev_state.baro_speed * 3 + (height_change / time_change)) / 4.0;
- else
- baro_speed = prev_state.baro_speed;
+ if (data.speed != AltosRecord.MISSING)
+ baro_speed = data.speed;
+ else {
+ if (time_change > 0)
+ baro_speed = (prev_state.baro_speed * 3 + (height_change / time_change)) / 4.0;
+ else
+ baro_speed = prev_state.baro_speed;
+ }
} else {
npad = 0;
ngps = 0;