[chirp_devel] [PATCH] [uv-b5]Add Test Mode Settings for Squelch Levels and Power Output Levels
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1378779173 14400 # Node ID faeedc1f4b5f978fb917adb68c752492cbb68433 # Parent c60b1cdee0f0549b7c1ae56507b3738778fc5b5d [uv-b5]Add Test Mode Settings for Squelch Levels and Power Output Levels that correspond to the OEM software's Test Mode settings menu.
add structure to support test mode settings add Test Mode menu add 8 VHF High Power settings add 8 VHF Low Power settings add 8 UHF High Power settings add 8 UHF Low Power settings add 10 VHF Squelch settings add 10 UHF Squelch settings #1123
diff -r c60b1cdee0f0 -r faeedc1f4b5f chirp/uvb5.py --- a/chirp/uvb5.py Mon Sep 09 14:06:23 2013 -0700 +++ b/chirp/uvb5.py Mon Sep 09 22:12:53 2013 -0400 @@ -96,6 +96,64 @@ lbcd lower_uhf[2]; lbcd upper_uhf[2]; } limits; + +#seekto 0x0FF0; +struct { + u8 vhfsquelch0; + u8 vhfsquelch1; + u8 vhfsquelch2; + u8 vhfsquelch3; + u8 vhfsquelch4; + u8 vhfsquelch5; + u8 vhfsquelch6; + u8 vhfsquelch7; + u8 vhfsquelch8; + u8 vhfsquelch9; + u8 unknown1[6]; + u8 uhfsquelch0; + u8 uhfsquelch1; + u8 uhfsquelch2; + u8 uhfsquelch3; + u8 uhfsquelch4; + u8 uhfsquelch5; + u8 uhfsquelch6; + u8 uhfsquelch7; + u8 uhfsquelch8; + u8 uhfsquelch9; + u8 unknown2[6]; + u8 vhfhipwr0; + u8 vhfhipwr1; + u8 vhfhipwr2; + u8 vhfhipwr3; + u8 vhfhipwr4; + u8 vhfhipwr5; + u8 vhfhipwr6; + u8 vhfhipwr7; + u8 vhflopwr0; + u8 vhflopwr1; + u8 vhflopwr2; + u8 vhflopwr3; + u8 vhflopwr4; + u8 vhflopwr5; + u8 vhflopwr6; + u8 vhflopwr7; + u8 uhfhipwr0; + u8 uhfhipwr1; + u8 uhfhipwr2; + u8 uhfhipwr3; + u8 uhfhipwr4; + u8 uhfhipwr5; + u8 uhfhipwr6; + u8 uhfhipwr7; + u8 uhflopwr0; + u8 uhflopwr1; + u8 uhflopwr2; + u8 uhflopwr3; + u8 uhflopwr4; + u8 uhflopwr5; + u8 uhflopwr6; + u8 uhflopwr7; +} test; """
def do_ident(radio): @@ -542,6 +600,217 @@ rs.set_apply_callback(apply_freq, self._memobj.broadcastfm[i]) bcastfm.append(rs)
+ testmode = RadioSettingGroup("testmode", "Test Mode Settings") + group.append(testmode) + + rs = RadioSetting("test.vhfhipwr0", "136-139 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr0)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr1", "140-144 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr1)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr2", "145-149 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr2)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr3", "150-154 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr3)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr4", "155-159 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr4)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr5", "160-164 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr5)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr6", "165-169 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr6)) + testmode.append(rs) + + rs = RadioSetting("test.vhfhipwr7", "170-174 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhfhipwr7)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr0", "136-139 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr0)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr1", "140-144 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr1)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr2", "145-149 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr2)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr3", "150-154 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr3)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr4", "155-159 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr4)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr5", "160-164 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr5)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr6", "165-169 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr6)) + testmode.append(rs) + + rs = RadioSetting("test.vhflopwr7", "170-174 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.vhflopwr7)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr0", "400-409 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr0)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr1", "410-419 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr1)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr2", "420-429 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr2)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr3", "430-439 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr3)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr4", "440-449 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr4)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr5", "450-459 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr5)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr6", "460-469 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr6)) + testmode.append(rs) + + rs = RadioSetting("test.uhfhipwr7", "470-479 Mhz High Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhfhipwr7)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr0", "400-409 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr0)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr1", "410-419 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr1)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr2", "420-429 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr2)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr3", "430-439 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr3)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr4", "440-449 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr4)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr5", "450-459 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr5)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr6", "460-469 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr6)) + testmode.append(rs) + + rs = RadioSetting("test.uhflopwr7", "470-479 Mhz Low Power", + RadioSettingValueInteger(0,255, self._memobj.test.uhflopwr7)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch0", "VHF Squelch 0", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch0)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch1", "VHF Squelch 1", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch1)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch2", "VHF Squelch 2", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch2)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch3", "VHF Squelch 3", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch3)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch4", "VHF Squelch 4", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch4)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch5", "VHF Squelch 5", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch5)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch6", "VHF Squelch 6", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch6)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch7", "VHF Squelch 7", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch7)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch8", "VHF Squelch 8", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch8)) + testmode.append(rs) + + rs = RadioSetting("test.vhfsquelch9", "VHF Squelch 9", + RadioSettingValueInteger(0,255, self._memobj.test.vhfsquelch9)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch0", "UHF Squelch 0", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch0)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch1", "UHF Squelch 1", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch1)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch2", "UHF Squelch 2", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch2)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch3", "UHF Squelch 3", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch3)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch4", "UHF Squelch 4", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch4)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch5", "UHF Squelch 5", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch5)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch6", "UHF Squelch 6", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch6)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch7", "UHF Squelch 7", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch7)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch8", "UHF Squelch 8", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch8)) + testmode.append(rs) + + rs = RadioSetting("test.uhfsquelch9", "UHF Squelch 9", + RadioSettingValueInteger(0,255, self._memobj.test.uhfsquelch9)) + testmode.append(rs) + return group
def set_settings(self, settings):
rs = RadioSetting("test.vhfsquelch0", "VHF Squelch 0",
RadioSettingValueInteger(0,255,
self._memobj.test.vhfsquelch0))
testmode.append(rs)
Hmm, this introduces a lot of redundant code. What would you think about trying to make it a little more automatic?
for band in ["vhf", "uhf"]: for index in range(0, 10): key = "test.%ssquelch%i" % (band, index) name = "%s Squelch %i" % (band.upper(), index) rs = RadioSetting(key, name, RadioSettingInteger(0, 255, getattr(self._memobj.test, "%ssquelch%i" % (band, index))
(Note that this is untested, just off the top of my head)
You could do this for squelch and power and save a bunch of lines of copied code in this patch.
What do you think?
On Tue, Sep 10, 2013 at 8:08 AM, Dan Smith dsmith@danplanet.com wrote:
rs = RadioSetting("test.vhfsquelch0", "VHF Squelch 0",
RadioSettingValueInteger(0,255,
self._memobj.test.vhfsquelch0))
testmode.append(rs)
Hmm, this introduces a lot of redundant code. What would you think about trying to make it a little more automatic?
for band in ["vhf", "uhf"]: for index in range(0, 10): key = "test.%ssquelch%i" % (band, index) name = "%s Squelch %i" % (band.upper(), index) rs = RadioSetting(key, name, RadioSettingInteger(0, 255, getattr(self._memobj.test, "%ssquelch%i" % (band, index))
(Note that this is untested, just off the top of my head)
You could do this for squelch and power and save a bunch of lines of copied code in this patch.
What do you think?
Actually, I woke up in the middle of the night last night thinking I could
have done this better.
Do you just reject what I submitted so I can just resubmit it after reworking it?
Jim
participants (3)
-
Dan Smith
-
Jim Unroe
-
Tom Hayward