From d8ebb83e64d66fa159e75aa560d39d80bb6d9d04 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 27 Mar 2012 10:38:32 -0700 Subject: 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 --- altosui/AltosConvert.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'altosui/AltosConvert.java') 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; } -- cgit v1.2.3