[chirp_devel] [PATCH] [UV-5R] Clean Up Code
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1434505600 14400 # Node ID 1b9c9d87d0c32a67498829d2a06e2389fea049af # Parent 317f6ec67709dc4a552dbfe09d1c2cd6e3fb916f [UV-5R] Clean Up Code
This patch is to make recently added code more readable. There are no changes in functionality.
Related to #2643
diff -r 317f6ec67709 -r 1b9c9d87d0c3 chirp/drivers/uv5r.py --- a/chirp/drivers/uv5r.py Tue Jun 16 21:43:24 2015 -0400 +++ b/chirp/drivers/uv5r.py Tue Jun 16 21:46:40 2015 -0400 @@ -809,8 +809,7 @@ if not _mem.scan: mem.skip = "S"
- if self.MODEL == "KT-980HP" or self.MODEL == "BF-F8HP" \ - or self.MODEL == "UV-82HP": + if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): levels = UV5R_POWER_LEVELS3 else: levels = UV5R_POWER_LEVELS @@ -916,8 +915,7 @@ _mem.wide = mem.mode == "FM"
if mem.power: - if self.MODEL == "KT-980HP" or self.MODEL == "BF-F8HP" \ - or self.MODEL == "UV-82HP": + if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): levels = [str(l) for l in UV5R_POWER_LEVELS3] _mem.lowpower = levels.index(str(mem.power)) else: @@ -1349,8 +1347,7 @@ rs.set_apply_callback(apply_offset, _vfob) workmode.append(rs)
- if self.MODEL == "KT-980HP" or self.MODEL == "BF-F8HP" \ - or self.MODEL == "UV-82HP": + if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): rs = RadioSetting("vfoa.txpower3", "VFO A Power", RadioSettingValueList( TXPOWER3_LIST,
On Fri, Jun 19, 2015 at 7:41 PM, Dan Smith dsmith@danplanet.com wrote:
This patch is to make recently added code more readable. There are no changes in functionality.
I didn't mean you _had_ to change it, but kudos anyway :)
--Dan
Dan,
I know. I read you 100%. I didn't like the way I did it to begin with and should have asked the group if there was a better way. This was so much more elegant that I couldn't wait to get rid of my original method. As always, thanks for the tip.
Jim
participants (2)
-
Dan Smith
-
Jim Unroe