diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-10 21:37:18 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-10 21:48:31 -0800 |
commit | 505ef49a041740fe7cbb5c537b68d22e5fb6c0be (patch) | |
tree | 16a34f77229899b477c7d9cb294e0c5939ac367e /micropeak/MicroStats.java | |
parent | e94f9547a566c74c30b6321bc073b8bdcb071604 (diff) |
micropeak: Report recorded apogee instead of searching flight data
This makes sure we report the true apogee value instead of looking for
the maximum height value in the flight data, in case the flight
recording ended before the apogee was reached.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroStats.java')
-rw-r--r-- | micropeak/MicroStats.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/micropeak/MicroStats.java b/micropeak/MicroStats.java index 056fac7d..90e9dd1f 100644 --- a/micropeak/MicroStats.java +++ b/micropeak/MicroStats.java @@ -58,12 +58,17 @@ public class MicroStats { } void find_apogee() { - apogee_height = 0; + apogee_height = data.apogee_height(); + double searched_apogee = 0; apogee_time = 0; + /* This just finds the apogee time -- we've recorded the + * peak altitude separately in eeprom, and that could + * have occurred after the eeprom was full. + */ for (MicroDataPoint point : data.points()) { - if (point.height > apogee_height) { - apogee_height = point.height; + if (point.height > searched_apogee) { + searched_apogee = point.height; apogee_time = point.time; } } |