summaryrefslogtreecommitdiff
path: root/altosui/AltosConvert.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-27 10:38:32 -0700
committerKeith Packard <keithp@keithp.com>2012-03-27 10:45:34 -0700
commitd8ebb83e64d66fa159e75aa560d39d80bb6d9d04 (patch)
treeb8388ffafeee81e3583e7e7160c0a7107b59f960 /altosui/AltosConvert.java
parentc1d12a117b36de7fe8dd992959b890bfd1163e81 (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/AltosConvert.java')
-rw-r--r--altosui/AltosConvert.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/altosui/AltosConvert.java b/altosui/AltosConvert.java
index db7039ec..df41a522 100644
--- a/altosui/AltosConvert.java
+++ b/altosui/AltosConvert.java
@@ -190,14 +190,18 @@ public class AltosConvert {
return ignite / 32767 * 15.0;
}
- static double radio_to_frequency(int setting, int cal, int channel) {
+ static double radio_to_frequency(int freq, int setting, int cal, int channel) {
double f;
- if (setting <= 0)
- setting = cal;
- f = 434.550 * setting / cal;
- /* Round to nearest 50KHz */
- f = Math.floor (20.0 * f + 0.5) / 20.0;
+ if (freq > 0)
+ f = freq / 1000.0;
+ else {
+ if (setting <= 0)
+ setting = cal;
+ f = 434.550 * setting / cal;
+ /* Round to nearest 50KHz */
+ f = Math.floor (20.0 * f + 0.5) / 20.0;
+ }
return f + channel * 0.100;
}