altosui: Fix telemetry file reader to handle tick count wrapping
[fw/altos] / ao-tools / altosui / AltosRomconfigUI.java
index bc511865a552c48c261ed2be2996cbc70b09993e..2134975dd833b7a0ae246b4178549f75542b27fe 100644 (file)
@@ -134,8 +134,17 @@ public class AltosRomconfigUI
        public void actionPerformed(ActionEvent e) {
                String  cmd = e.getActionCommand();
 
-               if (cmd.equals("ok"))
+               if (cmd.equals("ok")) {
+                       AltosRomconfig  romconfig = romconfig();
+                       if (romconfig == null || !romconfig.valid()) {
+                               JOptionPane.showMessageDialog(this,
+                                                             "Invalid serial number or radio calibration value",
+                                                             "Invalid rom configuration",
+                                                             JOptionPane.ERROR_MESSAGE);
+                               return;
+                       }
                        selected = true;
+               }
                setVisible(false);
        }
 
@@ -162,7 +171,7 @@ public class AltosRomconfigUI
                }
        }
 
-       public AltosRomconfig romconfig() {
+       AltosRomconfig romconfig() {
                try {
                        return new AltosRomconfig(serial(), radio_calibration());
                } catch (NumberFormatException ne) {