From: Keith Packard Date: Thu, 5 Mar 2020 02:23:14 +0000 (-0800) Subject: altoslib, altosui, telegps: Add configuration support for APRS offset X-Git-Tag: 1.9.3~1^2~50 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=47f4121ae6596bdf18566295df2fdbe94fe676b8 altoslib, altosui, telegps: Add configuration support for APRS offset Configure the position within each minute that APRS transmissions occur Signed-off-by: Keith Packard --- diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 474af359..3c5f6c06 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -78,6 +78,7 @@ public class AltosConfigData { public int aprs_interval; public int aprs_ssid; public int aprs_format; + public int aprs_offset; /* HAS_BEEP */ public int beep; @@ -296,6 +297,7 @@ public class AltosConfigData { aprs_interval = AltosLib.MISSING; aprs_ssid = AltosLib.MISSING; aprs_format = AltosLib.MISSING; + aprs_offset = AltosLib.MISSING; beep = AltosLib.MISSING; @@ -465,6 +467,7 @@ public class AltosConfigData { try { aprs_interval = get_int(line, "APRS interval:"); } catch (Exception e) {} try { aprs_ssid = get_int(line, "APRS SSID:"); } catch (Exception e) {} try { aprs_format = get_int(line, "APRS format:"); } catch (Exception e) {} + try { aprs_offset = get_int(line, "APRS offset:"); } catch (Exception e) {} /* HAS_BEEP */ try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {} @@ -661,6 +664,8 @@ public class AltosConfigData { aprs_ssid = source.aprs_ssid(); if (aprs_format != AltosLib.MISSING) aprs_format = source.aprs_format(); + if (aprs_offset != AltosLib.MISSING) + aprs_offset = source.aprs_offset(); /* HAS_BEEP */ if (beep != AltosLib.MISSING) @@ -718,6 +723,7 @@ public class AltosConfigData { dest.set_aprs_interval(aprs_interval); dest.set_aprs_ssid(aprs_ssid); dest.set_aprs_format(aprs_format); + dest.set_aprs_offset(aprs_offset); dest.set_beep(beep); dest.set_tracker_motion(tracker_motion); dest.set_tracker_interval(tracker_interval); @@ -822,6 +828,8 @@ public class AltosConfigData { link.printf("c S %d\n", aprs_ssid); if (aprs_format != AltosLib.MISSING) link.printf("c C %d\n", aprs_format); + if (aprs_offset != AltosLib.MISSING) + link.printf("c O %d\n", aprs_offset); /* HAS_BEEP */ if (beep != AltosLib.MISSING) diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index b12a610c..9496fa35 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -104,6 +104,10 @@ public interface AltosConfigValues { public abstract void set_aprs_format(int new_aprs_format); + public abstract int aprs_offset() throws AltosConfigDataException; + + public abstract void set_aprs_offset(int new_aprs_offset); + public abstract int beep() throws AltosConfigDataException; public abstract void set_beep(int new_beep); diff --git a/altosui/AltosConfigFCUI.java b/altosui/AltosConfigFCUI.java index 624c7246..2eb6ae75 100644 --- a/altosui/AltosConfigFCUI.java +++ b/altosui/AltosConfigFCUI.java @@ -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)"); @@ -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; @@ -1482,4 +1524,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; + } } diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index dc982dea..1a951309 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -43,6 +43,7 @@ public class TeleGPSConfigUI JLabel aprs_interval_label; JLabel aprs_ssid_label; JLabel aprs_format_label; + JLabel aprs_offset_label; JLabel flight_log_max_label; JLabel callsign_label; JLabel tracker_motion_label; @@ -61,6 +62,7 @@ public class TeleGPSConfigUI JComboBox aprs_interval_value; JComboBox aprs_ssid_value; JComboBox aprs_format_value; + JComboBox aprs_offset_value; JComboBox flight_log_max_value; JTextField callsign_value; JComboBox tracker_motion_value; @@ -84,6 +86,10 @@ public class TeleGPSConfigUI 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[] tracker_motion_values_m = { "2", "5", @@ -178,6 +184,15 @@ public class TeleGPSConfigUI 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)"); @@ -444,6 +459,33 @@ public class TeleGPSConfigUI 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; @@ -963,4 +1005,19 @@ public class TeleGPSConfigUI 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; + } }