From 601bba77330c6b0c242d990c8f4e2bc852472f1f Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 12 Jul 2023 19:27:20 -0700 Subject: [PATCH] uv5r: Warn about other settings not being honored Users are being confused by the fact that HN5RV radios no longer have the bulk of the "Other Settings" knobs. So, instead of hiding them and generating bug reports, show them but warn the user that they will not be uploaded to the radio and point them at the bug for tracking the actual issue. Related to #10721 Related to #10505 --- chirp/drivers/uv5r.py | 143 +++++++++++++++++++++++------------------- chirp/wxui/common.py | 5 +- 2 files changed, 82 insertions(+), 66 deletions(-) diff --git a/chirp/drivers/uv5r.py b/chirp/drivers/uv5r.py index 998959c0c..28e052541 100644 --- a/chirp/drivers/uv5r.py +++ b/chirp/drivers/uv5r.py @@ -1358,71 +1358,82 @@ def _filter(name): rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val) other.append(rs) - if not HN5RV: - _msg = self._memobj.sixpoweron_msg - rs = RadioSetting("sixpoweron_msg.line1", - "6+Power-On Message 1", - RadioSettingValueString( - 0, 7, _filter(_msg.line1))) - other.append(rs) - rs = RadioSetting("sixpoweron_msg.line2", - "6+Power-On Message 2", - RadioSettingValueString( - 0, 7, _filter(_msg.line2))) - other.append(rs) - - _msg = self._memobj.poweron_msg - rs = RadioSetting("poweron_msg.line1", "Power-On Message 1", - RadioSettingValueString( - 0, 7, _filter(_msg.line1))) - other.append(rs) - rs = RadioSetting("poweron_msg.line2", "Power-On Message 2", - RadioSettingValueString( - 0, 7, _filter(_msg.line2))) - other.append(rs) - - rs = RadioSetting("ponmsg", "Power-On Message", - RadioSettingValueList( - PONMSG_LIST, - PONMSG_LIST[_settings.ponmsg])) - other.append(rs) + aux_settings = [] + + _msg = self._memobj.sixpoweron_msg + rs = RadioSetting("sixpoweron_msg.line1", + "6+Power-On Message 1", + RadioSettingValueString( + 0, 7, _filter(_msg.line1))) + aux_settings.append(rs) + rs = RadioSetting("sixpoweron_msg.line2", + "6+Power-On Message 2", + RadioSettingValueString( + 0, 7, _filter(_msg.line2))) + aux_settings.append(rs) + + _msg = self._memobj.poweron_msg + rs = RadioSetting("poweron_msg.line1", "Power-On Message 1", + RadioSettingValueString( + 0, 7, _filter(_msg.line1))) + aux_settings.append(rs) + rs = RadioSetting("poweron_msg.line2", "Power-On Message 2", + RadioSettingValueString( + 0, 7, _filter(_msg.line2))) + aux_settings.append(rs) + + rs = RadioSetting("ponmsg", "Power-On Message", + RadioSettingValueList( + PONMSG_LIST, + PONMSG_LIST[_settings.ponmsg])) + aux_settings.append(rs) - if self._is_orig(): - limit = "limits_old" - else: - limit = "limits_new" - - vhf_limit = getattr(self._memobj, limit).vhf - rs = RadioSetting("%s.vhf.lower" % limit, - "VHF Lower Limit (MHz)", - RadioSettingValueInteger(1, 1000, - vhf_limit.lower)) - other.append(rs) - - rs = RadioSetting("%s.vhf.upper" % limit, - "VHF Upper Limit (MHz)", - RadioSettingValueInteger(1, 1000, - vhf_limit.upper)) - other.append(rs) - - rs = RadioSetting("%s.vhf.enable" % limit, "VHF TX Enabled", - RadioSettingValueBoolean(vhf_limit.enable)) - other.append(rs) - - uhf_limit = getattr(self._memobj, limit).uhf - rs = RadioSetting("%s.uhf.lower" % limit, - "UHF Lower Limit (MHz)", - RadioSettingValueInteger(1, 1000, - uhf_limit.lower)) - other.append(rs) - rs = RadioSetting("%s.uhf.upper" % limit, - "UHF Upper Limit (MHz)", - RadioSettingValueInteger(1, 1000, - uhf_limit.upper)) - other.append(rs) - rs = RadioSetting("%s.uhf.enable" % limit, "UHF TX Enabled", - RadioSettingValueBoolean(uhf_limit.enable)) - other.append(rs) + if self._is_orig(): + limit = "limits_old" + else: + limit = "limits_new" + + vhf_limit = getattr(self._memobj, limit).vhf + rs = RadioSetting("%s.vhf.lower" % limit, + "VHF Lower Limit (MHz)", + RadioSettingValueInteger(1, 1000, + vhf_limit.lower)) + aux_settings.append(rs) + + rs = RadioSetting("%s.vhf.upper" % limit, + "VHF Upper Limit (MHz)", + RadioSettingValueInteger(1, 1000, + vhf_limit.upper)) + aux_settings.append(rs) + + rs = RadioSetting("%s.vhf.enable" % limit, "VHF TX Enabled", + RadioSettingValueBoolean(vhf_limit.enable)) + aux_settings.append(rs) + + uhf_limit = getattr(self._memobj, limit).uhf + rs = RadioSetting("%s.uhf.lower" % limit, + "UHF Lower Limit (MHz)", + RadioSettingValueInteger(1, 1000, + uhf_limit.lower)) + aux_settings.append(rs) + rs = RadioSetting("%s.uhf.upper" % limit, + "UHF Upper Limit (MHz)", + RadioSettingValueInteger(1, 1000, + uhf_limit.upper)) + aux_settings.append(rs) + rs = RadioSetting("%s.uhf.enable" % limit, "UHF TX Enabled", + RadioSettingValueBoolean(uhf_limit.enable)) + aux_settings.append(rs) + + hn5rv_warn = ('This setting will not be uploaded to your radio ' + 'because some radios with your firmware version are ' + 'known to be broken when CHIRP sends that data ' + 'to them. Please see bug #10505 on the CHIRP ' + 'issue tracker for more details.') + for setting in aux_settings: + if HN5RV: + setting.set_warning(hn5rv_warn) + other.append(setting) if self.MODEL != "UV-6": workmode = RadioSettingGroup("workmode", "Work Mode Settings") @@ -1716,7 +1727,7 @@ def apply_code(setting, obj): RadioSettingValueInteger(0, 50, _settings.pttlt)) dtmf.append(rs) - if not self._is_orig() and self._aux_block and not HN5RV: + if not self._is_orig() and self._aux_block: service = RadioSettingGroup("service", "Service Settings") group.append(service) @@ -1732,6 +1743,8 @@ def apply_code(setting, obj): RadioSettingValueInteger( 0, 123, getattr(_obj, "sql%i" % (index)))) + if HN5RV: + rs.set_warning(hn5rv_warn) service.append(rs) return group diff --git a/chirp/wxui/common.py b/chirp/wxui/common.py index dc3a4cbc3..a22022ad1 100644 --- a/chirp/wxui/common.py +++ b/chirp/wxui/common.py @@ -396,7 +396,10 @@ def __init__(self, settinggroup, *a, **k): editor.Enable(value.get_mutable()) self.pg.Append(editor) - if element.get_warning(None) or element.volatile: + # Use object() as a sentinel that will never match the safe + # value to determine if we need to catch changes for this to + # check for a warning. + if element.get_warning(object()) or element.volatile: self.pg.Bind(wx.propgrid.EVT_PG_CHANGING, lambda evt: self._check_change(evt, element))