altosui: Report error message back from libaltos
[fw/altos] / altosui / AltosConfig.java
index 45521665236d1f461b4e4a9886c802d861419be0..93def70daaad2e527616da648c4384187d152c95 100644 (file)
@@ -223,10 +223,31 @@ public class AltosConfig implements ActionListener {
                        SwingUtilities.invokeLater(r);
                }
 
+               void reset_data() {
+                       serial.set(0);
+                       log_format.set(Altos.AO_LOG_FORMAT_UNKNOWN);
+                       main_deploy.set(250);
+                       apogee_delay.set(0);
+                       radio_channel.set(0);
+                       radio_setting.set(0);
+                       radio_calibration.set(1186611);
+                       radio_enable.set(-1);
+                       flight_log_max.set(0);
+                       ignite_mode.set(-1);
+                       pad_orientation.set(-1);
+                       storage_size.set(-1);
+                       storage_erase_unit.set(-1);
+                       stored_flight.set(-1);
+                       callsign.set("N0CALL");
+                       version.set("unknown");
+                       product.set("unknown");
+               }
+
                void get_data() {
                        try {
                                config.start_serial();
-                               stored_flight.set(-1);
+                               reset_data();
+
                                config.serial_line.printf("c s\nf\nl\nv\n");
                                for (;;) {
                                        try {
@@ -459,8 +480,7 @@ public class AltosConfig implements ActionListener {
                                }
                        } catch (FileNotFoundException ee) {
                                JOptionPane.showMessageDialog(owner,
-                                                             String.format("Cannot open device \"%s\"",
-                                                                           device.toShortString()),
+                                                             ee.getMessage(),
                                                              "Cannot open target device",
                                                              JOptionPane.ERROR_MESSAGE);
                        } catch (AltosSerialInUseException si) {