altosui: Stop downloading eeprom data on a block full of invalid data
[fw/altos] / altosui / AltosEepromDownload.java
index d1e5fdf0484cd2d51c3a70ef10f9e56761e81a46..65cac7bd75f67084e0259f5c73be023f820f1974 100644 (file)
@@ -134,7 +134,8 @@ public class AltosEepromDownload implements Runnable {
                                }
                                if (r.cmd == Altos.AO_LOG_STATE && r.a == Altos.ao_flight_landed)
                                        done = true;
-                               any_valid = true;
+                               if (r.cmd != AltosLib.AO_LOG_INVALID)
+                                       any_valid = true;
                                Log(r);
                        } catch (ParseException pe) {
                                if (parse_exception == null)
@@ -319,11 +320,9 @@ public class AltosEepromDownload implements Runnable {
                done = false;
                start = true;
 
-//             if (flights.config_data.serial == 0)
-//                     throw new IOException("no serial number found");
+               if (flights.config_data.serial == 0)
+                       throw new IOException("no serial number found");
 
-               log_format = 5;
-               System.out.printf ("log format: %d\n", log_format);
                /* Reset per-capture variables */
                flight = 0;
                year = 0;
@@ -338,7 +337,7 @@ public class AltosEepromDownload implements Runnable {
 
                state = 0; state_block = log.start_block;
                for (block = log.start_block; !done && block < log.end_block; block++) {
-                       monitor.set_value(Altos.state_to_string[state], state, block - state_block);
+                       monitor.set_value(AltosLib.state_name(state), state, block - state_block);
 
                        AltosEepromChunk        eechunk = new AltosEepromChunk(serial_line, block, block == log.start_block);