Project

General

Profile

Bug #5275 » chirp_bugfix_5275_v1.patch

Initial patch to address this - Mathias Weyland, 10/26/2017 10:28 AM

View differences:

chirp/drivers/alinco.py Thu Oct 19 12:02:09 2017 -0700 → chirp/drivers/alinco.py Tue Oct 24 22:12:54 2017 +0200
ul16 special_bank[7];
#seekto 0x1200;
struct {
u8 unknown;
u8 empty;
ul32 freq;
u8 mode;
u8 step;
......
u8 tx_tone;
u8 rx_tone;
u8 dcs;
#seek 3;
ul24 unknown1;
u8 skip;
#seek 12;
ul32 unknown2;
ul32 unknown3;
ul32 unknown4;
char name[32];
} memory[1000];
"""
......
_mem = self._memobj.memory[number]
mem = chirp_common.Memory()
mem.number = number
if _mem.unknown == 0:
if _mem.empty == 0:
mem.empty = True
else:
if _mem.unknown1 == 0xffffff:
# Previous versions of this code have not touched those unknown
# fields. They contain bytes of value if the channel is empty and
# thus those bytes remain 0xff when the channel is put to use.
# The radio is totally fine with this but the Alinco programming
# software is not (see #5275). Thus, we set them to the correct
# values manually to fix those images who are affected in this
# manner.
LOG.info("Fixing contradictory image (channel %d)" % number)
_mem.unknown1 = 0x3e001c
_mem.unknown2 = 0x0000000a
_mem.unknown3 = 0x00000000
_mem.unknown4 = 0x00000000
mem.freq = int(_mem.freq)
mem.mode = self.MODES[_mem.mode]
mem.tuning_step = self.STEPS[_mem.step]
......
# Get a low-level memory object mapped to the image
_mem = self._memobj.memory[mem.number]
if mem.empty:
_mem.unknown = 0x00 # Maybe 0 is empty, 2 is used?
_mem.set_raw("\xff" * (_mem.size()/8))
_mem.empty = 0x00 # Maybe 0 is empty, 2 is used?
else:
_mem.unknown = 0x02
_mem.empty = 0x02
_mem.freq = mem.freq
_mem.mode = self.MODES.index(mem.mode)
_mem.step = self.STEPS.index(mem.tuning_step)
......
_mem.dcs = DCS_CODES[self.VENDOR].index(mem.dtcs)
_mem.skip = (mem.skip == "S")
_mem.name = "\x00".join(mem.name).ljust(32, "\x00")
_mem.unknown1 = 0x3e001c
_mem.unknown2 = 0x0000000a
_mem.unknown3 = 0x00000000
_mem.unknown4 = 0x00000000
(3-3/5)