# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1419510301 18000 # Node ID 19242ec08941da524403353948d3d5959e07bbfa # Parent a81615723033a1f49794e33609913e563efe3ace [VV-898] Update Image Detections
Add method to fall back to original detection string for older data files
Add method to skip uploading settings area block for older data files
related to #2119
diff -r a81615723033 -r 19242ec08941 chirp/leixen.py --- a/chirp/leixen.py Wed Dec 24 14:16:04 2014 -0800 +++ b/chirp/leixen.py Thu Dec 25 07:25:01 2014 -0500 @@ -68,6 +68,12 @@ TMODES = ["", "Tone", "DTCS", "DTCS"]
+def _image_ident_from_data(data): + return data[0x170:0x176] + +def _image_ident_from_image(radio): + return _image_ident_from_data(radio.get_mmap()) + def checksum(frame): x = 0 for b in frame: @@ -139,9 +145,15 @@ return memmap.MemoryMap(data)
def do_upload(radio): + _ranges = [(0x0d00, 0x2000)] + + image_ident = _image_ident_from_image(radio) + if image_ident == radio._file_ident: + _ranges = radio._ranges + do_ident(radio) - - for start, end in radio._ranges: + + for start, end in _ranges: for addr in range(start, end, 0x10): frame = make_frame("W", addr, radio._mmap[addr:addr + 0x10]) send(radio, frame) @@ -348,7 +360,11 @@
@classmethod def match_model(cls, filedata, filename): - return filedata[0x170:0x176] == cls._file_ident + if filedata[0x170:0x176] == cls._file_ident: + return True + elif filedata[0x900:0x906] == cls.MODEL: + return True + return False
@directory.register