mirror of
https://github.com/kk7ds/chirp.git
synced 2024-09-21 18:47:18 +00:00
Fix Yaesu FTM-350 for py3
This commit is contained in:
parent
b9ae1d62aa
commit
66e1a9a70a
@ -119,7 +119,7 @@ def _clone_in(radio):
|
||||
radio.pipe.timeout = 1
|
||||
attempts = 30
|
||||
|
||||
data = memmap.MemoryMap("\x00" * (radio._memsize + 128))
|
||||
data = memmap.MemoryMapBytes(b"\x00" * (radio._memsize + 128))
|
||||
length = 0
|
||||
last_addr = 0
|
||||
while length < radio._memsize:
|
||||
@ -134,18 +134,18 @@ def _clone_in(radio):
|
||||
|
||||
if frame:
|
||||
addr, = struct.unpack(">H", frame[0:2])
|
||||
checksum = ord(frame[130])
|
||||
checksum = frame[130]
|
||||
block = frame[2:130]
|
||||
|
||||
cs = 0
|
||||
for i in frame[:-1]:
|
||||
cs = (cs + ord(i)) % 256
|
||||
cs = (cs + i) % 256
|
||||
if cs != checksum:
|
||||
LOG.debug("Calc: %02x Real: %02x Len: %i" %
|
||||
(cs, checksum, len(block)))
|
||||
raise errors.RadioError("Block failed checksum")
|
||||
|
||||
radio.pipe.write("\x06")
|
||||
radio.pipe.write(b"\x06")
|
||||
time.sleep(0.05)
|
||||
|
||||
if (last_addr + 128) != addr:
|
||||
@ -182,11 +182,11 @@ def _clone_out(radio):
|
||||
frame = struct.pack(">H", i) + block
|
||||
cs = 0
|
||||
for byte in frame:
|
||||
cs += ord(byte)
|
||||
frame += chr(cs % 256)
|
||||
cs += byte
|
||||
frame += bytes([cs % 256])
|
||||
radio.pipe.write(frame)
|
||||
ack = radio.pipe.read(1)
|
||||
if ack != "\x06":
|
||||
if ack != b"\x06":
|
||||
raise errors.RadioError("Radio refused block %i" % (i / 128))
|
||||
time.sleep(0.05)
|
||||
|
||||
@ -239,6 +239,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio):
|
||||
BAUD_RATE = 48000
|
||||
VENDOR = "Yaesu"
|
||||
MODEL = "FTM-350"
|
||||
NEEDS_COMPAT_SERIAL = False
|
||||
|
||||
_model = ""
|
||||
_memsize = 65536
|
||||
@ -279,6 +280,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio):
|
||||
except errors.RadioError:
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception('Failed to read: %s', e)
|
||||
raise errors.RadioError("Failed to download from radio (%s)" % e)
|
||||
self.process_mmap()
|
||||
|
||||
@ -288,6 +290,7 @@ class FTM350Radio(yaesu_clone.YaesuCloneModeRadio):
|
||||
except errors.RadioError:
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception('Failed to write: %s', e)
|
||||
raise errors.RadioError("Failed to upload to radio (%s)" % e)
|
||||
|
||||
def process_mmap(self):
|
||||
|
@ -343,7 +343,7 @@
|
||||
| <a name="Yaesu_FT2D_Rv2"></a> Yaesu_FT2D_Rv2 | | | Yes |
|
||||
| <a name="Yaesu_FT3D_R"></a> Yaesu_FT3D_R | | | Yes |
|
||||
| <a name="Yaesu_FTM-3200D_R"></a> Yaesu_FTM-3200D_R | | | Yes |
|
||||
| <a name="Yaesu_FTM-350"></a> Yaesu_FTM-350 | | | Yes |
|
||||
| <a name="Yaesu_FTM-350"></a> Yaesu_FTM-350 | [@kk7ds](https://github.com/kk7ds) | 4-Dec-2022 | Yes |
|
||||
| <a name="Yaesu_FTM-7250D_R"></a> Yaesu_FTM-7250D_R | | | Yes |
|
||||
| <a name="Yaesu_VX-170"></a> Yaesu_VX-170 | | | Yes |
|
||||
| <a name="Yaesu_VX-2"></a> Yaesu_VX-2 | | | Yes |
|
||||
@ -360,6 +360,6 @@
|
||||
|
||||
**Drivers:** 355
|
||||
|
||||
**Tested:** 38% (137/218)
|
||||
**Tested:** 38% (138/217)
|
||||
|
||||
**Byte clean:** 58% (209/146)
|
||||
|
@ -135,6 +135,7 @@ Yaesu_FT-818,+Yaesu_FT-817,14-Feb-2019
|
||||
Yaesu_FT-818ND_US,+Yaesu_FT-817,14-Feb-2019
|
||||
Yaesu_FT-857_897,+Yaesu_FT-817,14-Feb-2019
|
||||
Yaesu_FT-857_897_US,+Yaesu_FT-817,14-Feb-2019
|
||||
Yaesu_FTM-350,@kk7ds,4-Dec-2022
|
||||
Yaesu_VX-3,@kk7ds,15-Feb-2019
|
||||
Yaesu_VX-7,@kk7ds,15-Feb-2019
|
||||
Yaesu_VX-8R,+Yaesu_VX-8DR,15-Feb-2019
|
||||
|
Loading…
Reference in New Issue
Block a user