altosui: Accept serial number of zero for eeprom download
authorKeith Packard <keithp@keithp.com>
Wed, 17 Oct 2012 04:54:23 +0000 (21:54 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 17 Oct 2012 04:54:23 +0000 (21:54 -0700)
AVR-based products don't have a valid serial number, and so usually
report 0. Accept this by making the 'no serial number' case check for
negative values.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosConfigData.java
altosui/AltosEepromDownload.java

index 6f34363..a962b10 100644 (file)
@@ -134,6 +134,7 @@ public class AltosConfigData implements Iterable<String> {
                radio_setting = 0;
                radio_frequency = 0;
                stored_flight = 0;
+               serial = -1;
                for (;;) {
                        String line = link.get_reply();
                        if (line == null)
index a8cb24f..a5e9974 100644 (file)
@@ -314,7 +314,7 @@ public class AltosEepromDownload implements Runnable {
                done = false;
                start = true;
 
-               if (flights.config_data.serial == 0)
+               if (flights.config_data.serial < 0)
                        throw new IOException("no serial number found");
 
                /* Reset per-capture variables */