altosui: Accept serial number of zero for eeprom download
[fw/altos] / altosui / AltosEepromDownload.java
index 65cac7bd75f67084e0259f5c73be023f820f1974..a5e99749d9c12cb25cd035af04398df4b30e1442 100644 (file)
 
 package altosui;
 
-import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import javax.swing.table.*;
 import java.io.*;
 import java.util.*;
 import java.text.*;
-import java.util.prefs.*;
 import java.util.concurrent.*;
 import org.altusmetrum.AltosLib.*;
 
-import libaltosJNI.*;
-
 public class AltosEepromDownload implements Runnable {
 
        JFrame                  frame;
@@ -113,7 +107,7 @@ public class AltosEepromDownload implements Runnable {
 
                extension = "eeprom";
                set_serial(flights.config_data.serial);
-               for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromRecord.record_length) {
+               for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromRecord.record_length) {
                        try {
                                AltosEepromRecord r = new AltosEepromRecord(eechunk, i);
                                if (r.cmd == Altos.AO_LOG_FLIGHT)
@@ -220,7 +214,7 @@ public class AltosEepromDownload implements Runnable {
                boolean any_valid = false;
 
                extension = "science";
-               for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromTeleScience.record_length) {
+               for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromTeleScience.record_length) {
                        try {
                                AltosEepromTeleScience r = new AltosEepromTeleScience(eechunk, i);
                                if (r.type == AltosEepromTeleScience.AO_LOG_TELESCIENCE_START) {
@@ -273,7 +267,7 @@ public class AltosEepromDownload implements Runnable {
 
                extension = "mega";
                set_serial(flights.config_data.serial);
-               for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromMega.record_length) {
+               for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromMega.record_length) {
                        try {
                                AltosEepromMega r = new AltosEepromMega(eechunk, i);
                                if (r.cmd == Altos.AO_LOG_FLIGHT)
@@ -320,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 */