# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1332544384 21600 # Node ID 5140caa90d8e74ee570304e52a36a6c81153f116 # Parent ca42bc2080e10bc4d7fe2471807f8979d141e5b2 [vx5] Initialize unknown bits of new memories to safe defaults. Fixes #87.
diff -r ca42bc2080e1 -r 5140caa90d8e chirp/vx5.py --- a/chirp/vx5.py Fri Mar 23 14:12:38 2012 -0600 +++ b/chirp/vx5.py Fri Mar 23 17:13:04 2012 -0600 @@ -36,12 +36,11 @@ u8 unknown4:4, tuning_step:4; bbcd freq[3]; - u8 unknown5:6, + u8 icon:6, mode:2; char name[8]; bbcd offset[3]; - u8 unknown6:2, - tmode:2, + u8 tmode:4, power:2, duplex:2; u8 unknown7:2, @@ -123,7 +122,7 @@ mem.tuning_step = STEPS[_mem.tuning_step] mem.offset = int(_mem.offset) * 1000 mem.power = POWER_LEVELS[3 - _mem.power] - mem.tmode = TMODES[_mem.tmode] + mem.tmode = TMODES[_mem.tmode & 0x3] # masked so bad mems can be read mem.rtone = mem.ctone = chirp_common.TONES[_mem.tone] mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs]
@@ -135,6 +134,17 @@ _mem = self._memobj.memory[mem.number-1] _flg = self._memobj.flag[mem.number-1]
+ # initialize new channel to safe defaults + if not mem.empty and not _flg.used: + _mem.unknown1 = 0x00 + _mem.unknown2 = 0x00 + _mem.unknown3 = 0x00 + _mem.unknown4 = 0x00 + _mem.icon = 12 # file cabinet icon + _mem.unknown7 = 0x00 + _mem.unknown8 = 0x00 + _mem.unknown9 = 0x00 + _flg.used = not mem.empty _flg.visible = not mem.empty if mem.empty: