Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv5r: Warn about other settings not being honored #724

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading