X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=altosui%2FAltosConfigFCUI.java;h=b7dc70bf4cb9d1aa6d0fbca9456b63e08e885932;hb=e142c4bd6f2fbab74fb7b7cea7e9a19234ed0123;hp=3fe6cf94b0b0bb6352b914e04a04c65280a26728;hpb=558a143315f0345b79cc4f22aa4b643fedcded9c;p=fw%2Faltos diff --git a/altosui/AltosConfigFCUI.java b/altosui/AltosConfigFCUI.java index 3fe6cf94..b7dc70bf 100644 --- a/altosui/AltosConfigFCUI.java +++ b/altosui/AltosConfigFCUI.java @@ -23,8 +23,8 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.text.*; -import org.altusmetrum.altoslib_12.*; -import org.altusmetrum.altosuilib_12.*; +import org.altusmetrum.altoslib_14.*; +import org.altusmetrum.altosuilib_14.*; public class AltosConfigFCUI extends AltosUIDialog @@ -46,6 +46,7 @@ public class AltosConfigFCUI JLabel aprs_interval_label; JLabel aprs_ssid_label; JLabel aprs_format_label; + JLabel aprs_offset_label; JLabel flight_log_max_label; JLabel ignite_mode_label; JLabel pad_orientation_label; @@ -72,6 +73,7 @@ public class AltosConfigFCUI JComboBox aprs_interval_value; JComboBox aprs_ssid_value; JComboBox aprs_format_value; + JComboBox aprs_offset_value; JComboBox flight_log_max_value; JComboBox ignite_mode_value; JComboBox pad_orientation_value; @@ -130,6 +132,10 @@ public class AltosConfigFCUI 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + static Integer[] aprs_offset_values = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 + }; + static String[] beep_values = { "3750", "4000", @@ -236,6 +242,15 @@ public class AltosConfigFCUI aprs_format_value.setToolTipText("Hardware doesn't support APRS"); } + void set_aprs_offset_tool_tip() { + if (aprs_offset_value.isVisible()) + aprs_offset_value.setToolTipText("Set the APRS offset from top of minute"); + else if (aprs_offset_value.isVisible()) + aprs_offset_value.setToolTipText("Software version doesn't support setting the APRS offset"); + else + aprs_offset_value.setToolTipText("Hardware doesn't support APRS"); + } + void set_flight_log_max_tool_tip() { if (flight_log_max_value.isVisible()) flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)"); @@ -440,7 +455,7 @@ public class AltosConfigFCUI apogee_lockout_value.setEditable(true); apogee_lockout_value.addItemListener(this); pane.add(apogee_lockout_value, c); - apogee_lockout_value.setToolTipText("Time after boost while apogee detection is locked out"); + apogee_lockout_value.setToolTipText("Time after launch while apogee detection is locked out"); row++; /* Frequency */ @@ -621,6 +636,33 @@ public class AltosConfigFCUI set_aprs_format_tool_tip(); row++; + /* APRS offset */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + aprs_offset_label = new JLabel("APRS offset:"); + pane.add(aprs_offset_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = row; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + aprs_offset_value = new JComboBox(aprs_offset_values); + aprs_offset_value.setEditable(false); + aprs_offset_value.addItemListener(this); + aprs_offset_value.setMaximumRowCount(aprs_offset_values.length); + pane.add(aprs_offset_value, c); + set_aprs_offset_tool_tip(); + row++; + /* Callsign */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -954,13 +996,11 @@ public class AltosConfigFCUI } public void set_dirty() { - System.out.printf("set dirty\n"); dirty = true; save.setEnabled(true); } public void set_clean() { - System.out.printf("set clean\n"); dirty = false; save.setEnabled(false); } @@ -1231,16 +1271,18 @@ public class AltosConfigFCUI return AltosLib.MISSING; } - public void set_flight_log_max_limit(int new_flight_log_max_limit) { + public void set_flight_log_max_limit(int new_flight_log_max_limit, int new_storage_erase_unit) { flight_log_max_limit = new_flight_log_max_limit; if (new_flight_log_max_limit != AltosLib.MISSING) { flight_log_max_value.removeAllItems(); for (int i = 8; i >= 1; i--) { int size = flight_log_max_limit / i; + if (new_storage_erase_unit != 0) + size &= ~(new_storage_erase_unit - 1); flight_log_max_value.addItem(String.format("%d (%d flights)", size, i)); } } - if (flight_log_max != 0) + if (flight_log_max != 0 && flight_log_max != AltosLib.MISSING) set_flight_log_max(flight_log_max); } @@ -1429,20 +1471,29 @@ public class AltosConfigFCUI return pyro_firing_time; } + private String aprs_interval_string(int interval) { + if (interval == 0) + return "Disabled"; + return Integer.toString(interval); + } + + private int aprs_interval_value(String interval) throws AltosConfigDataException { + if (interval.equalsIgnoreCase("Disabled")) + return 0; + return parse_int("aprs interval", interval, false); + } + public void set_aprs_interval(int new_aprs_interval) { if (new_aprs_interval != AltosLib.MISSING) - aprs_interval_value.setSelectedItem(Integer.toString(new_aprs_interval)); + aprs_interval_value.setSelectedItem(aprs_interval_string(new_aprs_interval)); aprs_interval_value.setVisible(new_aprs_interval != AltosLib.MISSING); aprs_interval_label.setVisible(new_aprs_interval != AltosLib.MISSING); set_aprs_interval_tool_tip(); } public int aprs_interval() throws AltosConfigDataException { - if (aprs_interval_value.isVisible()) { - String s = aprs_interval_value.getSelectedItem().toString(); - - return parse_int("aprs interval", s, false); - } + if (aprs_interval_value.isVisible()) + return aprs_interval_value(aprs_interval_value.getSelectedItem().toString()); return AltosLib.MISSING; } @@ -1475,4 +1526,20 @@ public class AltosConfigFCUI return aprs_format_value.getSelectedIndex(); return AltosLib.MISSING; } + + public void set_aprs_offset(int new_aprs_offset) { + if (new_aprs_offset != AltosLib.MISSING) + aprs_offset_value.setSelectedItem(new_aprs_offset); + aprs_offset_value.setVisible(new_aprs_offset != AltosLib.MISSING); + aprs_offset_label.setVisible(new_aprs_offset != AltosLib.MISSING); + set_aprs_offset_tool_tip(); + } + + public int aprs_offset() throws AltosConfigDataException { + if (aprs_offset_value.isVisible()) { + Integer i = (Integer) aprs_offset_value.getSelectedItem(); + return i; + } + return AltosLib.MISSING; + } }