[chirp_devel] [PATCH] [UV-5X3] Add Out-of-Range Limit Checking for Band Limits
# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1604542914 18000 # Wed Nov 04 21:21:54 2020 -0500 # Node ID d85fee6c62662ec28c675ee8128a5758d8f39eda # Parent 054f05826531faa75d30ceed613b118b61691b54 [UV-5X3] Add Out-of-Range Limit Checking for Band Limits
This patch adds limit checking for the BTech UV-5X3 band limits.
related to #8393
diff -r 054f05826531 -r d85fee6c6266 chirp/drivers/uv5x3.py --- a/chirp/drivers/uv5x3.py Mon Nov 02 18:32:05 2020 -0500 +++ b/chirp/drivers/uv5x3.py Wed Nov 04 21:21:54 2020 -0500 @@ -678,14 +678,20 @@ else: lower = 130 upper = 179 + if int(_mem.limits.vhf.lower) < lower: + val = lower + else: + val = int(_mem.limits.vhf.lower) rs = RadioSetting("limits.vhf.lower", "VHF Lower Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.vhf.lower)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
+ if int(_mem.limits.vhf.upper) > upper: + val = upper + else: + val = int(_mem.limits.vhf.upper) rs = RadioSetting("limits.vhf.upper", "VHF Upper Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.vhf.upper)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
if str(_mem.firmware_msg.line1) == "UVVG302": @@ -697,14 +703,20 @@ else: lower = 220 upper = 225 + if int(_mem.limits.vhf2.lower) < lower: + val = lower + else: + val = int(_mem.limits.vhf2.lower) rs = RadioSetting("limits.vhf2.lower", "VHF2 Lower Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.vhf2.lower)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
+ if int(_mem.limits.vhf2.upper) > upper: + val = upper + else: + val = int(_mem.limits.vhf2.upper) rs = RadioSetting("limits.vhf2.upper", "VHF2 Upper Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.vhf2.upper)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
if str(_mem.firmware_msg.line1) == "UVVG302": @@ -713,14 +725,20 @@ else: lower = 400 upper = 520 + if int(_mem.limits.uhf.lower) < lower: + val = lower + else: + val = int(_mem.limits.uhf.lower) rs = RadioSetting("limits.uhf.lower", "UHF Lower Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.uhf.lower)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
+ if int(_mem.limits.uhf.upper) > upper: + val = upper + else: + val = int(_mem.limits.uhf.upper) rs = RadioSetting("limits.uhf.upper", "UHF Upper Limit (MHz)", - RadioSettingValueInteger( - lower, upper, _mem.limits.uhf.upper)) + RadioSettingValueInteger(lower, upper, val)) other.append(rs)
# Work mode settings
participants (1)
-
Jim Unroe