altosui: Stop parsing eeprom file after hitting 'landed' state 0.7.1
authorKeith Packard <keithp@keithp.com>
Fri, 10 Sep 2010 06:04:59 +0000 (23:04 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Sep 2010 06:07:16 +0000 (23:07 -0700)
Sometimes there are additional records found in the eeprom file; the
reader is mostly worried about not losing anything, so it reads as
much as it can. However, the last record written for any flight is the
'landed' record, so we can stop looking at the file after hitting that.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosEepromReader.java

index f1d6a6a7d8124b416f0e96246e3dbcf9730ba82e..4cc8536a64a22bf889b35e26e6bc1e6d6ca9dcb1 100644 (file)
@@ -391,6 +391,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) {