diff options
author | Keith Packard <keithp@keithp.com> | 2011-10-09 11:09:25 -0600 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-10-09 11:09:25 -0600 |
commit | 5d1361c95f94125cda244b4cc5e55c2fb77b680b (patch) | |
tree | 2b6027ae47085f209c8a0a2c292bfa265076bfac /altosui/AltosFlightStats.java | |
parent | 5c82b07471f017171c58a6968adf79901f46a987 (diff) |
altosui: Deal with missing state transitions in FlightStats window1.0.9.2
Any missing start/end times are pinned to the end of the flight.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosFlightStats.java')
-rw-r--r-- | altosui/AltosFlightStats.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/altosui/AltosFlightStats.java b/altosui/AltosFlightStats.java index 2067951e..72d12600 100644 --- a/altosui/AltosFlightStats.java +++ b/altosui/AltosFlightStats.java @@ -47,7 +47,7 @@ public class AltosFlightStats { AltosState state = null; AltosState new_state = null; double boost_time = -1; - double start_time; + double end_time = 0; year = month = day = -1; hour = minute = second = -1; @@ -62,9 +62,7 @@ public class AltosFlightStats { if ((record.seen & AltosRecord.seen_flight) != 0 && flight < 0) flight = record.flight; new_state = new AltosState(record, state); - if (state == null) { - start_time = new_state.time; - } + end_time = new_state.time; state = new_state; if (0 <= state.state && state.state < Altos.ao_flight_invalid) { if (state.state >= Altos.ao_flight_boost) { @@ -107,6 +105,10 @@ public class AltosFlightStats { state_baro_speed[s] /= state_count[s]; state_accel[s] /= state_count[s]; } + if (state_start[s] == 0) + state_start[s] = end_time; + if (state_end[s] == 0) + state_end[s] = end_time; } } |