[chirp_devel] [PATCH] [vx6] Initialize memories with safe defaults (zeros). Fixes #232

Tom Hayward
Thu Jul 5 12:01:18 PDT 2012


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1341514863 21600
# Node ID aaf354614d35d231a87d7f722a2e0ccb5449fcf0
# Parent  fa1c395002a493d90d651382382b28693ad0e3ae
[vx6] Initialize memories with safe defaults (zeros). Fixes #232

diff -r fa1c395002a4 -r aaf354614d35 chirp/vx6.py
--- a/chirp/vx6.py	Thu Jul 05 11:25:01 2012 -0600
+++ b/chirp/vx6.py	Thu Jul 05 13:01:03 2012 -0600
@@ -78,10 +78,8 @@
      tmode:3;
   u8 name[6];
   bbcd offset[3];
-  u8 unknown3:2,
-     tone:6;
-  u8 unknown4:1,
-     dcs:7;
+  u8 tone;
+  u8 dcs;
   u8 unknown5;
 } memory[900];
 """
@@ -167,13 +165,13 @@
 
         mem.freq = chirp_common.fix_rounded_step(int(_mem.freq) * 1000)
         mem.offset = int(_mem.offset) * 1000
-        mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone]
+        mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone & 0x3f]
         mem.tmode = TMODES[_mem.tmode]
         mem.duplex = DUPLEX[_mem.duplex]
         mem.mode = MODES[_mem.mode]
         if mem.mode == "FM" and _mem.half_deviation:
             mem.mode = "NFM"
-        mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs]
+        mem.dtcs = chirp_common.DTCS_CODES[_mem.dcs & 0x7f]
         mem.tuning_step = STEPS[_mem.tune_step]
         mem.skip = pskip and "P" or skip and "S" or ""
         
@@ -198,6 +196,16 @@
         used = _flag["%s_masked" % nibble]
         valid = _flag["%s_valid" % nibble]
 
+        # initialize new channel to safe defaults
+        if not mem.empty and not used:
+            _mem.unknown11 = 0
+            _mem.step_changed = 0
+            _mem.cpu_shifted = 0
+            _mem.unknown12 = 0
+            _mem.unknown2 = 0
+            _mem.pager = 0
+            _mem.unknown5 = 0
+
         if mem.empty and valid and not used:
             _flag["%s_valid" % nibble] = False
             return



More information about the chirp_devel mailing list