[chirp_devel] [PATCH] [uv-b5]Add Test Mode Settings for Squelch Levels and Power Output Levels

Dan Smith
Tue Sep 10 05:08:33 PDT 2013


> +        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?

-- 
Dan Smith
www.danplanet.com
KK7DS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130910/6ba11e1b/attachment-0001.bin 


More information about the chirp_devel mailing list