X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosEepromReader.java;h=03e738124f37e2bafd06f6327b42860f3cc4c1ee;hp=ac54ff4472344ffa07e59932ef36514bbd5c9998;hb=7ef3ad0c9354c0484c25badc69334b59c7f355e2;hpb=2d58f319a7c1a6a8ccc6a539722009996ba886ab diff --git a/ao-tools/altosui/AltosEepromReader.java b/ao-tools/altosui/AltosEepromReader.java index ac54ff44..03e73812 100644 --- a/ao-tools/altosui/AltosEepromReader.java +++ b/ao-tools/altosui/AltosEepromReader.java @@ -95,14 +95,11 @@ public class AltosEepromReader extends AltosReader { boolean last_reported; double ground_pres; - double ground_accel; int n_pad_samples; int gps_tick; - boolean saw_boost; - int boost_tick; boolean saw_gps_date; @@ -116,7 +113,9 @@ public class AltosEepromReader extends AltosReader { if (last_reported) return null; last_reported = true; - return new AltosRecord(state); + AltosRecord r = new AltosRecord(state); + r.time = (r.tick - boost_tick) / 100.0; + return r; } record = record_iterator.next(); @@ -130,9 +129,7 @@ public class AltosEepromReader extends AltosReader { state.tick = record.tick; switch (record.cmd) { case Altos.AO_LOG_FLIGHT: - state.ground_accel = record.a; - state.flight = record.b; - seen |= seen_flight; + /* recorded when first read from the file */ break; case Altos.AO_LOG_SENSOR: state.accel = record.a; @@ -142,9 +139,6 @@ public class AltosEepromReader extends AltosReader { ground_pres += state.pres; state.ground_pres = (int) (ground_pres / n_pad_samples); state.flight_pres = state.ground_pres; - ground_accel += state.accel; - state.ground_accel = (int) (ground_accel / n_pad_samples); - state.flight_accel = state.ground_accel; } else { state.flight_pres = (state.flight_pres * 15 + state.pres) / 16; state.flight_accel = (state.flight_accel * 15 + state.accel) / 16; @@ -345,11 +339,12 @@ public class AltosEepromReader extends AltosReader { if (record.cmd == Altos.AO_LOG_INVALID) continue; tick = record.tick; - if (!saw_boost && record.cmd == Altos.AO_LOG_STATE && - record.a >= Altos.ao_flight_boost) - { - saw_boost = true; + if (record.cmd == Altos.AO_LOG_FLIGHT) { + state.ground_accel = record.a; + state.flight_accel = record.a; + state.flight = record.b; boost_tick = tick; + seen |= seen_flight; } /* Two firmware bugs caused the loss of some GPS data. @@ -393,6 +388,11 @@ public class AltosEepromReader extends AltosReader { } } records.add(record); + + /* Bail after reading the 'landed' record; we're all done */ + if (record.cmd == Altos.AO_LOG_STATE && + record.a == Altos.ao_flight_landed) + break; } } catch (IOException io) { } catch (ParseException pe) {