diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-27 10:38:32 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-27 10:45:34 -0700 |
commit | d8ebb83e64d66fa159e75aa560d39d80bb6d9d04 (patch) | |
tree | b8388ffafeee81e3583e7e7160c0a7107b59f960 /altosui/AltosConfig.java | |
parent | c1d12a117b36de7fe8dd992959b890bfd1163e81 (diff) |
altosui: Configure radio with new direct frequency setting
Instead of computing the radio setting in altosui, let the radio do it directly.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosConfig.java')
-rw-r--r-- | altosui/AltosConfig.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index 93def70d..84261ec7 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -76,6 +76,7 @@ public class AltosConfig implements ActionListener { int_ref ignite_mode; int_ref pad_orientation; int_ref radio_setting; + int_ref radio_frequency; int_ref storage_size; int_ref storage_erase_unit; int_ref stored_flight; @@ -193,6 +194,7 @@ public class AltosConfig implements ActionListener { get_int(line, "Ignite mode:", ignite_mode); get_int(line, "Pad orientation:", pad_orientation); get_int(line, "Radio setting:", radio_setting); + get_int(line, "Frequency:", radio_frequency); get_int(line, "Radio enable:", radio_enable); get_int(line, "Storage size:", storage_size); get_int(line, "Storage erase unit:", storage_erase_unit); @@ -230,6 +232,7 @@ public class AltosConfig implements ActionListener { apogee_delay.set(0); radio_channel.set(0); radio_setting.set(0); + radio_frequency.set(0); radio_calibration.set(1186611); radio_enable.set(-1); flight_log_max.set(0); @@ -275,6 +278,7 @@ public class AltosConfig implements ActionListener { void save_data() { try { double frequency = frequency(); + boolean has_frequency = radio_frequency.get() > 0; boolean has_setting = radio_setting.get() > 0; start_serial(); serial_line.printf("c m %d\n", main_deploy.get()); @@ -282,6 +286,7 @@ public class AltosConfig implements ActionListener { if (!remote) serial_line.printf("c f %d\n", radio_calibration.get()); serial_line.set_radio_frequency(frequency, + has_frequency, has_setting, radio_calibration.get()); if (remote) { @@ -378,15 +383,19 @@ public class AltosConfig implements ActionListener { } double frequency() { - return AltosConvert.radio_to_frequency(radio_setting.get(), + return AltosConvert.radio_to_frequency(radio_frequency.get(), + radio_setting.get(), radio_calibration.get(), radio_channel.get()); } void set_frequency(double freq) { + int frequency = radio_frequency.get(); int setting = radio_setting.get(); - if (setting > 0) { + if (frequency > 0) { + radio_frequency.set((int) Math.floor (freq * 1000 + 0.5)); + } else if (setting > 0) { radio_setting.set(AltosConvert.radio_frequency_to_setting(freq, radio_calibration.get())); radio_channel.set(0); @@ -453,6 +462,7 @@ public class AltosConfig implements ActionListener { apogee_delay = new int_ref(0); radio_channel = new int_ref(0); radio_setting = new int_ref(0); + radio_frequency = new int_ref(0); radio_calibration = new int_ref(1186611); radio_enable = new int_ref(-1); flight_log_max = new int_ref(0); |