[chirp_devel] [PATCH] Fixup wouxun radio settings

K. Arvanitis
Mon Feb 9 12:22:15 PST 2015


# HG changeset patch
# User K. Arvanitis <kosta at alumni.uvic.ca>
# Date 1423513070 28800
#      Mon Feb 09 12:17:50 2015 -0800
# Node ID f74f533828ed82b85ab08301c8e4e6ae5faf5370
# Parent  bc148153a962d29a088663a8679e0962de04b720
Fixup wouxun radio settings

There was a small issue with the construction the top level radio settings
group for some of the wouxun radios.  This attempts to resolve that.

Bug #2285

diff -r bc148153a962 -r f74f533828ed chirp/anytone.py
--- a/chirp/anytone.py	Fri Feb 06 20:14:09 2015 -0800
+++ b/chirp/anytone.py	Mon Feb 09 12:17:50 2015 -0800
@@ -232,7 +232,8 @@
         result = radio.pipe.read(1)
         if result != "\x06":
             print "Ack was: %s" % repr(result)
-            raise errors.RadioError("Radio did not accept block at %04x" % addr)
+            raise errors.RadioError("Radio did not accept block at %04x" % \
+                            addr)
         return
     result = _read(radio, length + 6)
     _debug("Got:\n%s" % util.hexprint(result))
diff -r bc148153a962 -r f74f533828ed chirp/wouxun.py
--- a/chirp/wouxun.py	Fri Feb 06 20:14:09 2015 -0800
+++ b/chirp/wouxun.py	Mon Feb 09 12:17:50 2015 -0800
@@ -332,14 +332,15 @@
         return rf
 
     def get_settings(self):
-        freqranges = RadioSettingGroup("freqranges", "Freq ranges")
+        freqranges = RadioSettingGroup("freqranges", "Freq Ranges")
         fm_preset = RadioSettingGroup("fm_preset", "FM Presets")
-        top = RadioSettings(freqranges, fm_preset)
+        opt = RadioSettingGroup("options", "Options")
+        group = RadioSettings(opt, freqranges, fm_preset)
 
         rs = RadioSetting("menu_available", "Menu Available",
                           RadioSettingValueBoolean(
                             self._memobj.settings.menu_available))
-        top.append(rs)
+        opt.append(rs)
 
         rs = RadioSetting("vhf_rx_start", "1st band RX Lower Limit (MHz)",
                           RadioSettingValueInteger(50, 174, 
@@ -403,146 +404,146 @@
         rs = RadioSetting("ponmsg", "Poweron message",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.ponmsg]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.welcome1", "Power-On Message 1",
                           RadioSettingValueString(0, 6,
                               _filter(self._memobj.strings.welcome1)))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.welcome2", "Power-On Message 2",
                           RadioSettingValueString(0, 6,
                               _filter(self._memobj.strings.welcome2)))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.single_band", "Single Band Message",
                           RadioSettingValueString(0, 6,
                               _filter(self._memobj.strings.single_band)))
-        top.append(rs)
+        opt.append(rs)
         options = ["Channel", "ch/freq","Name", "VFO"]
         rs = RadioSetting("vfo_a_ch_disp", "VFO A Channel disp mode",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.vfo_a_ch_disp]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_ch_disp", "VFO B Channel disp mode",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.vfo_b_ch_disp]))
-        top.append(rs)
+        opt.append(rs)
         options = ["5.0", "6.25", "10.0", "12.5", "25.0", "50.0", "100.0"]
         rs = RadioSetting("vfo_a_fr_step", "VFO A Frequency Step",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.vfo_a_fr_step]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_fr_step", "VFO B Frequency Step",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.vfo_b_fr_step]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_a_squelch", "VFO A Squelch",
                           RadioSettingValueInteger(0, 9,
                               self._memobj.settings.vfo_a_squelch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_squelch", "VFO B Squelch",
                           RadioSettingValueInteger(0, 9,
                               self._memobj.settings.vfo_b_squelch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_a_cur_chan", "VFO A current channel",
                           RadioSettingValueInteger(1, 128,
                               self._memobj.settings.vfo_a_cur_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_cur_chan", "VFO B current channel",
                           RadioSettingValueInteger(1, 128,
                               self._memobj.settings.vfo_b_cur_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("priority_chan", "Priority channel",
                           RadioSettingValueInteger(0, 199,
                               self._memobj.settings.priority_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("power_save", "Power save",
                           RadioSettingValueBoolean(
                               self._memobj.settings.power_save))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Scan", "Lamp", "SOS", "Radio"]
         rs = RadioSetting("pf1_function", "PF1 Function select",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.pf1_function]))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Begin", "End", "Both"]
         rs = RadioSetting("roger_beep", "Roger beep select",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.roger_beep]))
-        top.append(rs)
+        opt.append(rs)
         options = ["%s" % x for x in range(15, 615, 15)]
         rs = RadioSetting("transmit_time_out", "TX Time-out Timer",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.transmit_time_out]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("tx_time_out_alert", "TX Time-out Alert",
                           RadioSettingValueInteger(0, 10,
                               self._memobj.settings.tx_time_out_alert))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vox", "Vox",
                           RadioSettingValueInteger(0, 10,
                               self._memobj.settings.vox))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Chinese", "English"]
         rs = RadioSetting("voice", "Voice",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.voice]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("beep", "Beep",
                           RadioSettingValueBoolean(self._memobj.settings.beep))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("ani_id_enable", "ANI id enable",
                           RadioSettingValueBoolean(
                               self._memobj.settings.ani_id_enable))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("ani_id_tx_delay", "ANI id tx delay",
                           RadioSettingValueInteger(0, 30,
                               self._memobj.settings.ani_id_tx_delay))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Key", "ANI", "Key+ANI"]
         rs = RadioSetting("ani_id_sidetone", "ANI id sidetone",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.ani_id_sidetone]))
-        top.append(rs)
+        opt.append(rs)
         options = ["Time", "Carrier", "Search"]
         rs = RadioSetting("scan_mode", "Scan mode",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.scan_mode]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("kbd_lock", "Keyboard lock",
                           RadioSettingValueBoolean(
                               self._memobj.settings.kbd_lock))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("auto_lock_kbd", "Auto lock keyboard",
                           RadioSettingValueBoolean(
                               self._memobj.settings.auto_lock_kbd))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("auto_backlight", "Auto backlight",
                           RadioSettingValueBoolean(
                               self._memobj.settings.auto_backlight))
-        top.append(rs)
+        opt.append(rs)
         options = ["CH A", "CH B"]
         rs = RadioSetting("sos_ch", "SOS CH",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.sos_ch]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("stopwatch", "Stopwatch",
                           RadioSettingValueBoolean(
                               self._memobj.settings.stopwatch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("dual_band_receive", "Dual band receive",
                           RadioSettingValueBoolean(
                               self._memobj.settings.dual_band_receive))
-        top.append(rs)
+        opt.append(rs)
         options = ["VFO A", "VFO B"]
         rs = RadioSetting("current_vfo", "Current VFO",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.current_vfo]))
-        top.append(rs)
+        opt.append(rs)
 
         options = ["Dual", "Single"]
         rs = RadioSetting("sd_available", "Single/Dual Band",
                           RadioSettingValueList(options,
                               options[self._memobj.settings.sd_available]))
-        top.append(rs)
+        opt.append(rs)
 
         _pwd = self._memobj.settings.mode_password
         rs = RadioSetting("mode_password", "Mode password (000000 disabled)",
@@ -552,7 +553,7 @@
                   RadioSettingValueInteger(0, 9, _pwd[3]),
                   RadioSettingValueInteger(0, 9, _pwd[4]),
                   RadioSettingValueInteger(0, 9, _pwd[5]))
-        top.append(rs)
+        opt.append(rs)
         _pwd = self._memobj.settings.reset_password
         rs = RadioSetting("reset_password", "Reset password (000000 disabled)",
                   RadioSettingValueInteger(0, 9, _pwd[0]),
@@ -561,7 +562,7 @@
                   RadioSettingValueInteger(0, 9, _pwd[3]),
                   RadioSettingValueInteger(0, 9, _pwd[4]),
                   RadioSettingValueInteger(0, 9, _pwd[5]))
-        top.append(rs)
+        opt.append(rs)
 
         dtmfchars = "0123456789 *#ABCD"
         _codeobj = self._memobj.settings.ani_id_content
@@ -578,7 +579,7 @@
                     value.append(0xFF)
             obj.ani_id_content = value
         rs.set_apply_callback(apply_ani_id, self._memobj.settings)
-        top.append(rs)
+        opt.append(rs)
 
         for i in range(0, 9):
             if self._memobj.fm_presets_0[i] != 0xFFFF:
@@ -603,7 +604,7 @@
                           RadioSettingValueFloat(76, 108, preset, 0.1, 1))
             fm_preset.append(rs)
 
-        return top
+        return group
 
     def set_settings(self, settings):
         for element in settings:
@@ -1043,14 +1044,15 @@
         return rf
 
     def get_settings(self):
-        freqranges = RadioSettingGroup("freqranges", "Freq ranges")
+        freqranges = RadioSettingGroup("freqranges", "Freq Ranges")
         fm_preset = RadioSettingGroup("fm_preset", "FM Presets")
-        top = RadioSettings(freqranges, fm_preset)
+        opt = RadioSettingGroup("options", "Options")
+        group = RadioSettings(opt, freqranges, fm_preset)
 
         rs = RadioSetting("menu_available", "Menu Available",
                           RadioSettingValueBoolean(
                             self._memobj.settings.menu_available))
-        top.append(rs)
+        opt.append(rs)
 
         rs = RadioSetting("vhf_rx_start", "VHF RX Lower Limit (MHz)",
                           RadioSettingValueInteger(1, 1000, 
@@ -1114,133 +1116,133 @@
         rs = RadioSetting("ponmsg", "Poweron message",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.ponmsg]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.welcome1", "Power-On Message 1",
                           RadioSettingValueString(0, 6, _filter(self._memobj.strings.welcome1)))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.welcome2", "Power-On Message 2",
                           RadioSettingValueString(0, 6, _filter(self._memobj.strings.welcome2)))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("strings.single_band", "Single Band Message",
                           RadioSettingValueString(0, 6, _filter(self._memobj.strings.single_band)))
-        top.append(rs)
+        opt.append(rs)
         options = ["Channel", "ch/freq","Name", "VFO"]
         rs = RadioSetting("vfo_a_ch_disp", "VFO A Channel disp mode",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.vfo_a_ch_disp]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_ch_disp", "VFO B Channel disp mode",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.vfo_b_ch_disp]))
-        top.append(rs)
+        opt.append(rs)
         options = ["2.5", "5.0", "6.25", "10.0", "12.5", "25.0", "50.0", "100.0"]
         rs = RadioSetting("vfo_a_fr_step", "VFO A Frequency Step",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.vfo_a_fr_step]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_fr_step", "VFO B Frequency Step",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.vfo_b_fr_step]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_a_squelch", "VFO A Squelch",
                           RadioSettingValueInteger(0, 9, self._memobj.settings.vfo_a_squelch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_squelch", "VFO B Squelch",
                           RadioSettingValueInteger(0, 9, self._memobj.settings.vfo_b_squelch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_a_cur_chan", "VFO A current channel",
                           RadioSettingValueInteger(1, 199, self._memobj.settings.vfo_a_cur_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vfo_b_cur_chan", "VFO B current channel",
                           RadioSettingValueInteger(1, 199, self._memobj.settings.vfo_b_cur_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("priority_chan", "Priority channel",
                           RadioSettingValueInteger(0, 199, self._memobj.settings.priority_chan))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("power_save", "Power save",
                           RadioSettingValueBoolean(self._memobj.settings.power_save))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Scan", "Lamp", "SOS", "Radio"]
         rs = RadioSetting("pf1_function", "PF1 Function select",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.pf1_function]))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Radio", "fr/ch", "Rpt", "Stopwatch", "Lamp", "SOS"]
         rs = RadioSetting("pf2_function", "PF2 Function select",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.pf2_function]))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Begin", "End", "Both"]
         rs = RadioSetting("roger_beep", "Roger beep select",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.roger_beep]))
-        top.append(rs)
+        opt.append(rs)
         options = ["%s" % x for x in range(15, 615, 15)]
         rs = RadioSetting("transmit_time_out", "TX Time-out Timer",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.transmit_time_out]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("tx_time_out_alert", "TX Time-out Alert",
                           RadioSettingValueInteger(0, 10, self._memobj.settings.tx_time_out_alert))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("vox", "Vox",
                           RadioSettingValueInteger(0, 10, self._memobj.settings.vox))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Chinese", "English"]
         rs = RadioSetting("voice", "Voice",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.voice]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("beep", "Beep",
                           RadioSettingValueBoolean(self._memobj.settings.beep))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("ani_id_enable", "ANI id enable",
                           RadioSettingValueBoolean(self._memobj.settings.ani_id_enable))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("ani_id_tx_delay", "ANI id tx delay",
                           RadioSettingValueInteger(0, 30, self._memobj.settings.ani_id_tx_delay))
-        top.append(rs)
+        opt.append(rs)
         options = ["Off", "Key", "ANI", "Key+ANI"]
         rs = RadioSetting("ani_id_sidetone", "ANI id sidetone",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.ani_id_sidetone]))
-        top.append(rs)
+        opt.append(rs)
         options = ["Time", "Carrier", "Search"]
         rs = RadioSetting("scan_mode", "Scan mode",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.scan_mode]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("kbd_lock", "Keyboard lock",
                           RadioSettingValueBoolean(self._memobj.settings.kbd_lock))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("auto_lock_kbd", "Auto lock keyboard",
                           RadioSettingValueBoolean(self._memobj.settings.auto_lock_kbd))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("auto_backlight", "Auto backlight",
                           RadioSettingValueBoolean(self._memobj.settings.auto_backlight))
-        top.append(rs)
+        opt.append(rs)
         options = ["CH A", "CH B"]
         rs = RadioSetting("sos_ch", "SOS CH",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.sos_ch]))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("stopwatch", "Stopwatch",
                           RadioSettingValueBoolean(self._memobj.settings.stopwatch))
-        top.append(rs)
+        opt.append(rs)
         rs = RadioSetting("dual_band_receive", "Dual band receive",
                           RadioSettingValueBoolean(self._memobj.settings.dual_band_receive))
-        top.append(rs)
+        opt.append(rs)
         options = ["VFO A", "VFO B"]
         rs = RadioSetting("current_vfo", "Current VFO",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.current_vfo]))
-        top.append(rs)
+        opt.append(rs)
 
         options = ["Dual", "Single"]
         rs = RadioSetting("sd_available", "Single/Dual Band",
                           RadioSettingValueList(options,
                                         options[self._memobj.settings.sd_available]))
-        top.append(rs)
+        opt.append(rs)
 
         _pwd = self._memobj.settings.mode_password
         rs = RadioSetting("mode_password", "Mode password (000000 disabled)",
@@ -1250,7 +1252,7 @@
                   RadioSettingValueInteger(0, 9, _pwd[3]),
                   RadioSettingValueInteger(0, 9, _pwd[4]),
                   RadioSettingValueInteger(0, 9, _pwd[5]))
-        top.append(rs)
+        opt.append(rs)
         _pwd = self._memobj.settings.reset_password
         rs = RadioSetting("reset_password", "Reset password (000000 disabled)",
                   RadioSettingValueInteger(0, 9, _pwd[0]),
@@ -1259,7 +1261,7 @@
                   RadioSettingValueInteger(0, 9, _pwd[3]),
                   RadioSettingValueInteger(0, 9, _pwd[4]),
                   RadioSettingValueInteger(0, 9, _pwd[5]))
-        top.append(rs)
+        opt.append(rs)
 
         dtmfchars = "0123456789 *#ABCD"
         _codeobj = self._memobj.settings.ani_id_content
@@ -1276,7 +1278,7 @@
                     value.append(0xFF)
             obj.ani_id_content = value
         rs.set_apply_callback(apply_ani_id, self._memobj.settings)
-        top.append(rs)
+        opt.append(rs)
 
         for i in range(0, 9):
             if self._memobj.fm_presets_0[i] != 0xFFFF:
@@ -1301,7 +1303,7 @@
                           RadioSettingValueFloat(76, 108, preset, 0.1, 1))
             fm_preset.append(rs)
 
-        return top
+        return group
 
     def set_settings(self, settings):
         for element in settings:
@@ -1424,7 +1426,7 @@
         return rf
 
     def get_settings(self):
-        freqranges = RadioSettingGroup("freqranges", "Freq ranges (read only)")
+        freqranges = RadioSettingGroup("freqranges", "Freq Ranges (read only)")
         group = RadioSettings(freqranges)
 
         rs = RadioSetting("vhf_rx_start", "vhf rx start",



More information about the chirp_devel mailing list