From: Keith Packard Date: Wed, 28 Mar 2012 04:48:43 +0000 (-0700) Subject: altosui: Catch attempt to set radio frequency to 0.0 -- use default X-Git-Tag: 1.0.9.4~44 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=sidebyside;h=2f19f9a0eaba22789fdc07a52849e8aaf6fe4695;p=fw%2Faltos 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 --- 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,