diff options
author | Keith Packard <keithp@keithp.com> | 2013-08-31 01:48:02 -0500 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-08-31 01:48:58 -0500 |
commit | f07f6d55edf5b97020680b3ce1d9e00bb3df64a6 (patch) | |
tree | d701ad9e7a598d2436eb66d3cd958409c364a374 /altoslib/AltosEepromFile.java | |
parent | de8d9c5630ae46378c50faf97f7d2e97fe139e30 (diff) |
altoslib/altosui: Get legacy telem working with new AltosState structure
Make AltosTelemetry work without AltosRecord
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosEepromFile.java')
-rw-r--r-- | altoslib/AltosEepromFile.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/altoslib/AltosEepromFile.java b/altoslib/AltosEepromFile.java index bcc7171e..2f4c54d7 100644 --- a/altoslib/AltosEepromFile.java +++ b/altoslib/AltosEepromFile.java @@ -57,6 +57,7 @@ public class AltosEepromFile extends AltosStateIterable { AltosEepromIterable headers; AltosEepromIterable body; + AltosState start; public void write_comments(PrintStream out) { headers.write(out); @@ -70,9 +71,9 @@ public class AltosEepromFile extends AltosStateIterable { public AltosEepromFile(FileInputStream input) { headers = new AltosEepromIterable(AltosEepromHeader.read(input)); - AltosState state = headers.state(); + start = headers.state(); - switch (state.log_format) { + switch (start.log_format) { case AltosLib.AO_LOG_FORMAT_FULL: body = new AltosEepromIterable(AltosEepromTM.read(input)); break; @@ -86,26 +87,24 @@ public class AltosEepromFile extends AltosStateIterable { body = new AltosEepromIterable(AltosEepromMini.read(input)); break; } - } - int boost_tick (AltosState start) { + /* Find boost tick */ AltosState state = start.clone(); for (AltosEeprom eeprom : body) { eeprom.update_state(state); - if (state.state >= AltosLib.ao_flight_boost) - return state.tick; + if (state.state >= AltosLib.ao_flight_boost) { + start.set_boost_tick(state.tick); + break; + } } - return 0; } public Iterator<AltosState> iterator() { - - AltosState state = headers.state(); - Iterator<AltosEeprom> i = body.iterator(); + AltosState state = start.clone(); + Iterator<AltosEeprom> i = body.iterator(); while (i.hasNext() && !state.valid()) i.next().update_state(state); - state.set_boost_tick(boost_tick(state)); return new AltosEepromIterator(state, i); } }
\ No newline at end of file |