[chirp_devel] [PATCH] [uv5r]Add Shift and Offset support to Work Mode VFO Presets
Jim Unroe
Tue Feb 19 16:20:09 PST 2013
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1361319296 18000
# Node ID 36293926e162128da56feec659698981119fff3a
# Parent 4bf797d4483c5b521f81639dd4405d82c05ff4a7
[uv5r]Add Shift and Offset support to Work Mode VFO Presets
update vfoa and vfob structure to support sftd (shift direction)
add the following Work Mode tab presets
Shift (Off, +, -)
Offset (0.00 - 69.95 MHz)
#599
diff -r 4bf797d4483c -r 36293926e162 chirp/uv5r.py
--- a/chirp/uv5r.py Mon Feb 18 21:33:26 2013 -0500
+++ b/chirp/uv5r.py Tue Feb 19 19:14:56 2013 -0500
@@ -131,7 +131,8 @@
u8 unused1:7,
band:1;
u8 unknown3;
- u8 unused2:4,
+ u8 unused2:2,
+ sftd:2,
scode:4;
u8 unknown4;
u8 unused3:1
@@ -153,7 +154,8 @@
u8 unused1:7,
band:1;
u8 unknown3;
- u8 unused2:4,
+ u8 unused2:2,
+ sftd:2,
scode:4;
u8 unknown4;
u8 unused3:1
@@ -948,6 +950,45 @@
rs.set_apply_callback(apply_freq, self._memobj.vfob)
workmode.append(rs)
+ options = ["Off", "+", "-"]
+ rs = RadioSetting("vfoa.sftd", "VFO A Shift",
+ RadioSettingValueList(options,
+ options[self._memobj.vfoa.sftd]))
+ workmode.append(rs)
+
+ rs = RadioSetting("vfob.sftd", "VFO B Shift",
+ RadioSettingValueList(options,
+ options[self._memobj.vfob.sftd]))
+ workmode.append(rs)
+
+ def convert_bytes_to_offset(bytes):
+ real_offset = 0
+ for byte in bytes:
+ real_offset = (real_offset * 10) + byte
+ return chirp_common.format_freq(real_offset * 10000)
+
+ def apply_offset(setting, obj):
+ print setting.value
+ value = chirp_common.parse_freq(str(setting.value)) / 10000
+ print value
+ print obj
+ for i in range(3, -1, -1):
+ obj.offset[i] = value % 10
+ value /= 10
+ print "Applied %s:\n%s" % (setting.value, obj)
+
+ val1a = RadioSettingValueString(0, 10,
+ convert_bytes_to_offset(self._memobj.vfoa.offset))
+ rs = RadioSetting("vfoa.offset", "VFO A Offset (0.00-69.95)", val1a)
+ rs.set_apply_callback(apply_offset, self._memobj.vfoa)
+ workmode.append(rs)
+
+ val1b = RadioSettingValueString(0, 10,
+ convert_bytes_to_offset(self._memobj.vfob.offset))
+ rs = RadioSetting("vfob.offset", "VFO B Offset (0.00-69.95)", val1b)
+ rs.set_apply_callback(apply_offset, self._memobj.vfob)
+ workmode.append(rs)
+
options = ["High", "Low"]
rs = RadioSetting("vfoa.txpower", "VFO A Power",
RadioSettingValueList(options,
More information about the chirp_devel
mailing list