[chirp_devel] [PATCH] Minor fix to get raw memories for IC-V86

Kosta A.
Mon Sep 27 12:02:13 PDT 2021


# HG changeset patch
# User Kosta A. <ve7kcy at gmail.com>
# Date 1632769324 25200
#      Mon Sep 27 12:02:04 2021 -0700
# Branch ic-v86
# Node ID 2f0fe9b098c661b27fe2a4bcee180e25813bb4db
# Parent  5aa2294d78ea241c6573dcf1929475b072e73685
Minor fix to get raw memories for IC-V86.

diff --git a/chirp/drivers/icv86.py b/chirp/drivers/icv86.py
--- a/chirp/drivers/icv86.py
+++ b/chirp/drivers/icv86.py
@@ -80,20 +80,14 @@
 
 """
 
-SPECIAL = {
+
+SPECIAL_CHANNELS = {
     "0A": 200, "0B": 201,
     "1A": 202, "1B": 203,
     "2A": 204, "2B": 205,
     "C": 206,
 }
 
-SPECIAL_REV = {
-    200: "0A", 201: "0B",
-    202: "1A", 203: "1B",
-    204: "2A", 205: "2B",
-    206: "C",
-}
-
 TMODES = ["", "Tone", "TSQL", "DTCS", "DTCS-R"]
 MODES = ["FM", "NFM"]
 SKIPS = ["", "S"]
@@ -132,7 +126,7 @@
         rf.valid_power_levels = POWER_LEVELS
         rf.valid_skips = SKIPS
         rf.valid_name_length = 5
-        rf.valid_special_chans = sorted(SPECIAL.keys())
+        rf.valid_special_chans = sorted(SPECIAL_CHANNELS.keys())
         rf.valid_bands = [(136000000, 174000000)]
         rf.has_ctone = True
         rf.has_offset = True
@@ -213,7 +207,7 @@
                 LOG.debug(element.get_name())
                 raise
 
-    def _get_memory(self, number):
+    def _get_memory(self, number, extd_number = None):
         bit = 1 << (number % 8)
         byte = int(number / 8)
 
@@ -226,7 +220,7 @@
             _usd = self._memobj.used[byte]
             _skp = self._memobj.skips[byte]
         else:
-            mem.extd_number = SPECIAL_REV[number]
+            mem.extd_number = extd_number
             mem.immutable = ["name", "number", "extd_number", "skip"]
             _usd = self._memobj.used[byte] if (number <= 206) else None
             _skp = None
@@ -272,13 +266,15 @@
 
         assert(self._mmap)
 
+        extd_number = None
         if isinstance(number, str):
             try:
-                number = SPECIAL[number]
+                extd_number = number
+                number = SPECIAL_CHANNELS[number]
             except KeyError:
                 raise errors.InvalidMemoryLocation("Unknown channel %s" % number)
 
-        return self._get_memory(number)
+        return self._get_memory(number, extd_number)
 
     def _fill_memory(self, number):
         _mem = self._memobj.memory[number]
@@ -287,7 +283,7 @@
 
         # zero-fill
         _mem.freq = 146010000
-        _mem.offset = 146010000
+        _mem.offset = 0x0
         _mem.name =  str("").ljust(5)
         _mem.reserved1 = 0x0
         _mem.rtone = 0x8
@@ -320,7 +316,6 @@
         _mem = self._memobj.memory[mem.number]
         _usd = self._memobj.used[byte] if mem.number <= 206 else None
         _skp = self._memobj.skips[byte] if mem.number < 200 else None
-
         assert(_mem)
 
         if mem.empty:
@@ -352,10 +347,8 @@
             _usd &= ~bit
 
         if _skp is not None:
-            if mem.skip == "S":
-                _skp |= bit
-            else:
-                _skp &= ~bit
+            if mem.skip == "S": _skp |= bit
+            else: _skp &= ~bit
 
     def set_memory(self, mem):
         if not self._mmap:
@@ -366,6 +359,5 @@
         return self._set_memory(mem)
 
     def get_raw_memory(self, number):
-        return repr(self._memobj.memory[number]) + \
-            repr(self._memobj.flags[(number)])
+        return repr(self._memobj.memory[number])
 



More information about the chirp_devel mailing list