Skip to content

Commit

Permalink
uv5r: Warn about other settings not being honored
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kk7ds committed Jul 14, 2023
1 parent e5a4292 commit 249a7a3
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 66 deletions.
143 changes: 78 additions & 65 deletions chirp/drivers/uv5r.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion chirp/wxui/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 249a7a3

Please sign in to comment.