X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=telegps%2FTeleGPSConfig.java;h=3505b0bb643ba186cb51cdbdf9b568ccfa817970;hp=ffb2d6122bc594433047c7ec232ba3610a6a28ba;hb=ae1174317fc476e39077f7dc257ec08709c6b301;hpb=a7fd31842a602a8ac803d0e09efb4ffabf7a289b diff --git a/telegps/TeleGPSConfig.java b/telegps/TeleGPSConfig.java index ffb2d612..3505b0bb 100644 --- a/telegps/TeleGPSConfig.java +++ b/telegps/TeleGPSConfig.java @@ -221,22 +221,28 @@ public class TeleGPSConfig 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) {