summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-27 21:48:43 -0700
committerKeith Packard <keithp@keithp.com>2012-03-27 21:48:43 -0700
commit2f19f9a0eaba22789fdc07a52849e8aaf6fe4695 (patch)
tree23e506caec4cb8ad0600d9847e04a7381c418038
parent170510bb183715e9ba580b180f20657d6602644e (diff)
altosui: Catch attempt to set radio frequency to 0.0 -- use default
Monitor idle was setting the frequency to 0, which takes a while with the new native radio frequency setting code. Don't do that, instead pull out the preferred frequency for that, as is done in other places where a frequency of 0.0 is used. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosSerial.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index ff1a91a5..dffc74ea 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -380,6 +380,8 @@ public class AltosSerial implements Runnable {
int cal) {
if (debug)
System.out.printf("set_radio_frequency %7.3f (freq %b) (set %b) %d\n", frequency, has_frequency, has_setting, cal);
+ if (frequency == 0)
+ return;
if (has_frequency)
set_radio_freq((int) Math.floor (frequency * 1000));
else if (has_setting)
@@ -390,6 +392,8 @@ public class AltosSerial implements Runnable {
public void set_radio_frequency(double in_frequency) throws InterruptedException, TimeoutException {
frequency = in_frequency;
+ if (frequency == 0.0)
+ frequency = AltosPreferences.frequency(device.getSerial());
config_data();
set_radio_frequency(frequency,
config_data.radio_frequency != 0,