[chirp_devel] New mod for issue 5943

Rick DeWitt
Fri Jul 13 07:54:08 PDT 2018


OK, here is the patch to allow for driver-generated comments. Mods to 
chirp_common and run_tests. Otherwise pretty simple. Just ignores the 
Comment field in compare_mem module of runt_tests.py if the feature 
attribute 'generated_comment' is true.
Also note my new issue #5941 about the View > Columns discrepancy in the 
latest release. I poked about a bit to try to find the problem and was 
only able to see that the wrong memedit page is being returned in 
mainapp at do_columns.

-- 
Rick DeWitt
AA0RD
Sequim, Washington, USA
360-681-3494

-------------- next part --------------
# HG changeset patch
# User Rick DeWitt <aa0rd at yahoo.com>
# Date 1531492770 25200
#      Fri Jul 13 07:39:30 2018 -0700
# Node ID a6a46946fa5e0ca7692d86dbacd457d62e8964a1
# Parent  b4f3246e3a55b37c9ac47abe87c45aaed6babbad
[FT-450D] Add new driver-generated comment attribute to CHIRP. Issue # 5943

Modifications to chirp_common.py to add the feature attribute 'generated_comment' boolean and to
runt_tests.py to test for that attribute and ignore the Comment field in compare_mem if set.
New FT-405D driver includes this new capability to put the memory group channel in Comment.

diff -r 4f6978a84b3e -r b4f3246e3a55 chirp/chirp_common.py
--- a/chirp/chirp_common.py	Sun Jul 01 17:52:10 2018 +0200
+++ b/chirp/chirp_common.py	Fri Jul 13 07:36:35 2018 -0700
@@ -724,6 +724,7 @@
         "has_sub_devices":      BOOLEAN,
         "memory_bounds":        (0, 0),
         "can_odd_split":        BOOLEAN,
+        "generated_comment":    BOOLEAN,
 
         # D-STAR
         "requires_call_lists":  BOOLEAN,
@@ -852,6 +853,9 @@
         self.init("can_odd_split", False,
                   "Indicates that the radio can store an independent " +
                   "transmit frequency")
+        self.init("generated_comment", False,
+                  "Indicates that the driver generates the Comment field, " +
+                  "which is not user-modifyable.")
 
         self.init("requires_call_lists", True,
                   "[D-STAR] Indicates that the radio requires all callsigns " +
diff -r 4f6978a84b3e -r b4f3246e3a55 chirp/drivers/ft450d.py
--- a/chirp/drivers/ft450d.py	Sun Jul 01 17:52:10 2018 +0200
+++ b/chirp/drivers/ft450d.py	Fri Jul 13 07:36:35 2018 -0700
@@ -31,7 +31,6 @@
 CMD_ACK = 0x06
 # TBD: Enable some form of generated UI field, for the memory tags
 # That field wiould not be stored in img file, but generated in get_memory
-MEM_GRP_LBL = False     # To ignore Comment channel-tags for now
 EX_MODES = ["USER-L", "USER-U", "LSB+CW", "USB+CW", "RTTY-L", "RTTY-U", "N/A"]
 for i in EX_MODES:
     chirp_common.MODES.append(i)
@@ -371,17 +370,19 @@
     def get_prompts(cls):
         rp = chirp_common.RadioPrompts()
         rp.info = _(dedent("""
-            The FT-450 radio driver loads the 'Special Channels' tab
+            - The FT-450 radio driver loads the 'Special Channels' tab
             with the PMS scanning range memories (group 11), 60meter
             channels (group 12), the QMB (STO/RCL) memory, the HF and
             50m HOME memories and all the A and B VFO memories.
-            There are VFO memories for the last frequency dialed in
+            - There are VFO memories for the last frequency dialed in
             each band. The last mem-tune config is also stored.
-            These Special Channels allow limited field editting.
-            This driver also populates the 'Other' tab in the channel
+            - These Special Channels allow limited field editting.
+            - This driver also populates the 'Other' tab in the channel
             memory Properties window. This tab contains values for
             those channel memory settings that don't fall under the
             standard Chirp display columns.
+            - The 'Comment' column contains the memory group label,
+            if groups are enabled.
             """))
         rp.pre_download = _(dedent("""\
             1. Turn radio off.
@@ -520,8 +521,8 @@
         rf = chirp_common.RadioFeatures()
         rf.has_bank = False
         rf.has_dtcs= False
-        if MEM_GRP_LBL:
-            rf.has_comment = True   # Used for Mem-Grp number
+        rf.has_comment = True
+        rf.generated_comment = True
         rf.valid_modes = list(set(self.MODES))
         rf.valid_tmodes = list(self.TMODES)
         rf.valid_duplexes = list(self.DUPLEX)
@@ -567,6 +568,7 @@
 
     def _get_special(self, number):
         mem = chirp_common.Memory()
+        _settings = self._memobj.settings
         mem.number = self.SPECIAL_MEMORIES[number]
         mem.extd_number = number
 
@@ -602,7 +604,7 @@
             mx = (-self.LAST_PMS_INDEX) + mem.number
             _mem = self._memobj.pms[mx]
             mx = mx + 1
-            if MEM_GRP_LBL:
+            if _settings.mem_grp:
                 mem.comment = "M-11-%02i" % mx
             immutable = ["number", "rtone", "ctone", "extd_number",
                          "tmode", "cross_mode",
@@ -611,7 +613,7 @@
             mx = (-self.LAST_60M_INDEX) + mem.number
             _mem = self._memobj.m60[mx]
             mx = mx + 1
-            if MEM_GRP_LBL:
+            if _settings.mem_grp:
                 mem.comment = "M-12-%02i" % mx
             immutable = ["number", "rtone", "ctone", "extd_number",
                          "tmode", "cross_mode",
@@ -677,6 +679,7 @@
 
     def _get_normal(self, number):
         _mem = self._memobj.memory[number - 1]
+        _settings = self._memobj.settings
         used = (self._memobj.visible[(number - 1) / 8] >> (number - 1) % 8) \
                 & 0x01
         valid = (self._memobj.filled[(number - 1) / 8] >> (number - 1) % 8) \
@@ -688,9 +691,9 @@
             mem.empty = True
             if not valid or _mem.freq == 0xffffffff:
                 return mem
-        if MEM_GRP_LBL:
+        if _settings.mem_grp:
             mgrp = int((number - 1) / 50)
-            mem.comment = "M-%02i-%02i" % (mgrp + 1, number - (mgrp * 50))
+            mem.comment= "M-%02i-%02i" % (mgrp + 1, number - (mgrp * 50))
         return self._get_memory(mem, _mem)
 
     def _set_normal(self, mem):
diff -r 4f6978a84b3e -r b4f3246e3a55 tests/run_tests.py
--- a/tests/run_tests.py	Sun Jul 01 17:52:10 2018 +0200
+++ b/tests/run_tests.py	Fri Jul 13 07:36:35 2018 -0700
@@ -194,6 +194,8 @@
                 continue  # FIXME
             elif k == "immutable":
                 continue
+            elif k == "comment" and rf.generated_comment:        # @@@
+                continue
             elif k == "name":
                 if not rf.has_name:
                     continue  # Don't complain about name, if not supported


More information about the chirp_devel mailing list