[chirp_devel] [PATCH] [KG-UV3]Add FM Presets
Jim Unroe
Sat Dec 7 18:02:21 PST 2013
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1386445464 18000
# Node ID eee14df4c4e590bf653da9a507a009be070e06e3
# Parent a7632ab56621a4843eb0f6cd2e917196510b615e
[KG-UV3]Add FM Presets
for Wouxun KG-UVD1P, KG-UV2 and KG-UV3
expose fm preset settings fields in memmap
add FM Presets tab
add FM Preset settings and other associated support
related to #1167
diff -r a7632ab56621 -r eee14df4c4e5 chirp/wouxun.py
--- a/chirp/wouxun.py Fri Dec 06 14:57:28 2013 -0500
+++ b/chirp/wouxun.py Sat Dec 07 14:44:24 2013 -0500
@@ -85,6 +85,12 @@
u8 unknown[2];
} memory[199];
+ #seekto 0x0842;
+ u16 fm_presets_0[9];
+
+ #seekto 0x0882;
+ u16 fm_presets_1[9];
+
#seekto 0x0970;
struct {
u16 vhf_rx_start;
@@ -324,7 +330,8 @@
def get_settings(self):
freqranges = RadioSettingGroup("freqranges", "Freq ranges")
- top = RadioSettingGroup("top", "All Settings", freqranges)
+ fm_preset = RadioSettingGroup("fm_preset", "FM Presets")
+ top = RadioSettingGroup("top", "All Settings", freqranges, fm_preset)
rs = RadioSetting("menu_available", "Menu Available",
RadioSettingValueBoolean(
@@ -570,6 +577,29 @@
rs.set_apply_callback(apply_ani_id, self._memobj.settings)
top.append(rs)
+ for i in range(0, 9):
+ if self._memobj.fm_presets_0[i] != 0xFFFF:
+ used = True
+ preset = self._memobj.fm_presets_0[i]/10.0+76
+ else:
+ used = False
+ preset = 76
+ rs = RadioSetting("fm_presets_0_%1i" % i, "Team 1 Location %i" % (i+1),
+ RadioSettingValueBoolean(used),
+ RadioSettingValueFloat(76, 108, preset, 0.1, 1))
+ fm_preset.append(rs)
+ for i in range(0, 9):
+ if self._memobj.fm_presets_1[i] != 0xFFFF:
+ used = True
+ preset = self._memobj.fm_presets_1[i]/10.0+76
+ else:
+ used = False
+ preset = 76
+ rs = RadioSetting("fm_presets_1_%1i" % i, "Team 2 Location %i" % (i+1),
+ RadioSettingValueBoolean(used),
+ RadioSettingValueFloat(76, 108, preset, 0.1, 1))
+ fm_preset.append(rs)
+
return top
def set_settings(self, settings):
@@ -577,6 +607,8 @@
if not isinstance(element, RadioSetting):
if element.get_name() == "freqranges" :
self._set_freq_settings(element)
+ elif element.get_name() == "fm_preset" :
+ self._set_fm_preset(element)
else:
self.set_settings(element)
continue
@@ -602,6 +634,26 @@
print element.get_name()
raise
+ def _set_fm_preset(self, settings):
+ obj = self._memobj
+ for element in settings:
+ try:
+ (bank, index) = (int(a) for a in element.get_name().split("_")[-2:])
+ val = element.value
+ if val[0].get_value():
+ value = int(val[1].get_value()*10-760)
+ else:
+ value = 0xffff
+ print "Setting fm_presets_%1i[%1i] = %s" % (bank, index, value)
+ if bank == 0:
+ setting = self._memobj.fm_presets_0
+ else:
+ setting = self._memobj.fm_presets_1
+ setting[index] = value
+ except Exception, e:
+ print element.get_name()
+ raise
+
def _set_freq_settings(self, settings):
for element in settings:
try:
More information about the chirp_devel
mailing list