X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfig.java;h=e47b0e22e6cd1b0af79192bae9f360a6c822cad0;hp=1cd61a89fa32b4d5c0006813f747d02c307bdb89;hb=ce4c8a8ad57515e851207b0a82f3af791bb30d3e;hpb=1ed6b13e87c1cc2d6618b6ba3a293ea6e3b5752e diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index 1cd61a89..e47b0e22 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -22,8 +22,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.text.*; -import org.altusmetrum.AltosLib.*; -import org.altusmetrum.altosuilib.*; +import org.altusmetrum.altoslib_10.*; +import org.altusmetrum.altosuilib_10.*; public class AltosConfig implements ActionListener { @@ -161,9 +161,9 @@ public class AltosConfig implements ActionListener { } finally { try { stop_serial(); + serial_line.close(); } catch (InterruptedException ie) { } - serial_line.close(); } } @@ -229,22 +229,28 @@ public class AltosConfig implements ActionListener { void save_data() { - /* bounds check stuff */ - if (config_ui.flight_log_max() > data.log_limit()) { + try { + /* bounds check stuff */ + if (config_ui.flight_log_max() > data.log_space() / 1024) { + JOptionPane.showMessageDialog(owner, + String.format("Requested flight log, %dk, is larger than the available space, %dk.\n", + config_ui.flight_log_max(), + data.log_space() / 1024), + "Maximum Flight Log Too Large", + JOptionPane.ERROR_MESSAGE); + return; + } + + /* Pull data out of the UI and stuff back into our local data record */ + + data.get_values(config_ui); + run_serial_thread(serial_mode_save); + } catch (AltosConfigDataException ae) { JOptionPane.showMessageDialog(owner, - String.format("Requested flight log, %dk, is larger than the available space, %dk.\n", - config_ui.flight_log_max(), - data.log_limit()), - "Maximum Flight Log Too Large", + ae.getMessage(), + "Configuration Data Error", JOptionPane.ERROR_MESSAGE); - return; } - - /* Pull data out of the UI and stuff back into our local data record */ - - data.get_values(config_ui); - - run_serial_thread(serial_mode_save); } public void actionPerformed(ActionEvent e) { @@ -298,4 +304,4 @@ public class AltosConfig implements ActionListener { } } } -} \ No newline at end of file +}