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