[chirp_devel] [PATCH] [th9800] initialize memories properly if previously inactive #2187

Jens Jensen
Sat Jan 17 08:16:40 PST 2015


# HG changeset patch
# User Jens Jensen <af5mi at yahoo.com>
# Date 1421511054 21600
#      Sat Jan 17 10:10:54 2015 -0600
# Node ID e09db41200fd27c4b1638f6fe59caef168f21164
# Parent  f0823e0e20ab9a37a9261722b08de260a4fc86e7
[th9800] initialize memories properly if previously inactive #2187

Memories were not getting initialized if previously unused, causing exceptions
This will additionally initialize memory if it was previously marked inactive
in the radio.

diff -r f0823e0e20ab -r e09db41200fd chirp/th9800.py
--- a/chirp/th9800.py	Sat Jan 17 09:33:28 2015 -0600
+++ b/chirp/th9800.py	Sat Jan 17 10:10:54 2015 -0600
@@ -322,15 +322,17 @@
 
   def set_memory(self, mem):
     _mem = self._memobj.memory[mem.number - 1]
+    
+    _prev_active = self.get_chan_active(mem.number)
     self.set_chan_active(mem.number, not mem.empty)
+    if mem.empty or not _prev_active:
+      if CHIRP_DEBUG:
+        print "initializing memory channel %d" % mem.number
+      _mem.set_raw(BLANK_MEMORY)
+    
     if mem.empty:
-      _mem.set_raw(BLANK_MEMORY)
       return
 
-    #if _mem.get_raw() == BLANK_MEMORY:
-    #    print "Initializing empty memory"
-    #    _mem.set_raw(BLANK_MEMORY)
-
     _mem.rx_freq = mem.freq / 10
     if mem.duplex == "split":
         _mem.tx_freq = mem.offset / 10



More information about the chirp_devel mailing list