[chirp_devel] [PATCH] [FT-70] #5329 Corrects handling of Mycall string – Thanks Fred
nicolas jon pike
Wed May 2 13:43:46 PDT 2018
# HG changeset patch
# User Nicolas Pike <nicolas.jon.pike at gmail.com>
# Date 1525293803 -3600
# Wed May 02 21:43:23 2018 +0100
# Node ID c03cbe42c1eb1e47d2582c0cf08bc4fce43d6def
# Parent bbbe50c6a1e5384375cd63f7d1a0254d9f8422a4
[FT-70] #5329 Corrects handling of Mycall string – Thanks Fred.
diff -r bbbe50c6a1e5 -r c03cbe42c1eb chirp/drivers/ft70.py
--- a/chirp/drivers/ft70.py Wed Apr 11 11:12:01 2018 -0700
+++ b/chirp/drivers/ft70.py Wed May 02 21:43:23 2018 +0100
@@ -23,7 +23,7 @@
RadioSettingValueList, RadioSettingValueBoolean, \
InvalidValueError
from textwrap import dedent
-
+import string
LOG = logging.getLogger(__name__)
# Testing
@@ -339,7 +339,8 @@
MEM_CALLSIGN_FORMAT = """
#seekto 0x0ced0;
struct {
- char padded_string[10]; // 63 MYCALL Set the call sign. (up to 10 characters)
+ char callsign[10]; // 63 MYCALL Set the call sign. (up to 10 characters)
+ u16 charset; // character set ID
} my_call;
"""
@@ -527,6 +528,8 @@
_GM_RING = ("OFF", "IN RING", "AlWAYS")
_GM_INTERVAL = ("LONG", "NORMAL", "OFF")
+ _MYCALL_CHR_SET = list(string.uppercase) + list(string.digits) + ['-','/' ]
+
@classmethod
def get_prompts(cls):
rp = chirp_common.RadioPrompts()
@@ -937,7 +940,16 @@
def _get_digital_settings(self):
menu = RadioSettingGroup("digital_settings", "Digital")
-
+
+ # MYCALL
+ mycall = self._memobj.my_call
+ mycallstr = str(mycall.callsign).rstrip("\xFF")
+
+ mycallentry = RadioSettingValueString(0, 10, mycallstr, False, charset=self._MYCALL_CHR_SET)
+ rs = RadioSetting('mycall.callsign', 'MYCALL', mycallentry)
+ rs.set_apply_callback(self.apply_mycall, mycall)
+ menu.append(rs)
+
# Short Press AMS button AMS TX Mode
digital_settings = self._memobj.digital_settings
@@ -1170,3 +1182,10 @@
rawval = setting.value.get_value()
val = 0 if cls._DIG_POP_UP.index(rawval) == 0 else cls._DIG_POP_UP.index(rawval) + 9
obj.digital_popup = val
+
+ def apply_mycall(cls, setting, obj):
+ cs = setting.value.get_value()
+ if cs[0] in ('-', '/'):
+ raise InvalidValueError("First character of call sign can't be - or /: {0:s}".format(cs))
+ else:
+ obj.callsign = cls._add_ff_pad(cs.rstrip(), 10)
More information about the chirp_devel
mailing list