diff options
author | Keith Packard <keithp@keithp.com> | 2013-10-14 20:42:14 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-14 20:42:14 -0700 |
commit | db4cd8b3838d27bebdeb6a085a739a36f7634a91 (patch) | |
tree | c1e2b489b2f1c50714fa6ac3ffbd380384a0e7a4 /altoslib/AltosState.java | |
parent | 1bd9786802751391cca3b83ac3045029e00e39ee (diff) |
altoslib,altosui: Be more robust when graphing bogus .telem files
Deal with files containing multiple serial number/flight number values
by preserving the boost_tick value across state resets.
Check for invalid state when computing actual boost time for the stats
window.
Ignore invalid speed/accel values when computing averages.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosState.java')
-rw-r--r-- | altoslib/AltosState.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index a01cddb7..6d55b833 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -836,7 +836,9 @@ public class AltosState implements Cloneable { if (flight != AltosLib.MISSING && flight != 0) { if (this.flight != AltosLib.MISSING && this.flight != flight) { + int bt = boost_tick; init(); + boost_tick = bt; } this.flight = flight; } @@ -847,7 +849,9 @@ public class AltosState implements Cloneable { if (serial != AltosLib.MISSING) { if (this.serial != AltosLib.MISSING && this.serial != serial) { + int bt = boost_tick; init(); + boost_tick = bt; } this.serial = serial; } @@ -1017,10 +1021,9 @@ public class AltosState implements Cloneable { if (tick == AltosLib.MISSING) return 0.0; - if (boost_tick != AltosLib.MISSING) { - return (tick - boost_tick) / 100.0; - } - return tick / 100.0; + if (boost_tick == AltosLib.MISSING) + return tick / 100.0; + return (tick - boost_tick) / 100.0; } public boolean valid() { |