altosui: Always read whole eeprom block, even at end of flight
authorKeith Packard <keithp@keithp.com>
Sat, 19 Feb 2011 09:04:19 +0000 (01:04 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 19 Mar 2011 23:50:38 +0000 (16:50 -0700)
Instead of stopping early, continue reading the whole eeprom block so
that the extra serial data doesn't end up confusing the next user of
the serial line, which may well be reading the next flight.

Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 629a7637871b24fe6d1204aaa7185d84933d4639)

altosui/AltosEepromBlock.java

index f223f3fb99edd3f14c9ae3a71b50c810f3f10c7e..11438df8bf536d40ccc7061a002bf6852b3353c7 100644 (file)
@@ -56,7 +56,7 @@ public class AltosEepromBlock extends ArrayList<AltosEepromRecord> {
                has_lon = false;
                has_time = false;
                serial_line.printf("e %x\n", block);
-               for (addr = 0; !done && addr < 0x100;) {
+               for (addr = 0; addr < 0x100;) {
                        try {
                                AltosEepromRecord r = new AltosEepromRecord(serial_line, block * 256 + addr);
 
@@ -93,10 +93,15 @@ public class AltosEepromBlock extends ArrayList<AltosEepromRecord> {
                                        lon = (double) (r.a | (r.b << 16)) / 1e7;
                                        has_lon = true;
                                }
+                               if (!done)
+                                       add(addr / 8, r);
                                if (r.cmd == Altos.AO_LOG_STATE && r.a == Altos.ao_flight_landed)
                                        done = true;
-                               add(addr / 8, r);
                        } catch (ParseException pe) {
+                               AltosEepromRecord       r = new AltosEepromRecord(Altos.AO_LOG_INVALID,
+                                                                                 0, 0, 0);
+                               if (!done)
+                                       add(addr/8, r);
                        }
                        addr += 8;
                }