Skip to content

Commit

Permalink
Fixed manually removing spaces when editing banknames. Fixes #11031
Browse files Browse the repository at this point in the history
Banknames can now be edited without having to manually remove spaces.
  • Loading branch information
vdwel authored and kk7ds committed Dec 22, 2023
1 parent 100517f commit f83662b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chirp/drivers/baofeng_uv17Pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,10 @@ def _filterName(name):
if ord(str(char)) == 255:
break
fname += int(char).to_bytes(1, 'big')
return fname.decode('gb2312')
return fname.decode('gb2312').strip()

def apply_bankname(setting, obj):
name = str(setting.value).encode('gb2312')[:16]
name = str(setting.value).encode('gb2312')[:16].ljust(16, b"\xff")
obj.name = name

if self._has_support_for_banknames:
Expand All @@ -760,7 +760,7 @@ def apply_bankname(setting, obj):
rs = RadioSetting("bank_name/%i.name" % i,
"Bank name %i" % (i + 1),
RadioSettingValueString(
0, 16, _filterName(_nameobj.name), True,
0, 16, _filterName(_nameobj.name), False,
CHARSET_GB2312))
rs.set_apply_callback(apply_bankname, _nameobj)
bank.append(rs)
Expand Down Expand Up @@ -1054,6 +1054,7 @@ def set_memory(self, mem):
class UV17ProGPS(UV17Pro):
VENDOR = "Baofeng"
MODEL = "UV-17ProGPS"

_has_support_for_banknames = True
_magic = MSTRING_UV17PROGPS
_magics = [b"\x46", b"\x4d", b"\x53\x45\x4E\x44\x21\x05\x0D\x01\x01" +
Expand Down

0 comments on commit f83662b

Please sign in to comment.