# HG changeset patch # User Nicolas Pike nicolas.jon.pike@gmail.com # Date 1521827521 0 # Fri Mar 23 17:52:01 2018 +0000 # Node ID 9e3b0ff763087f08758900b006199e2ea60b57dc # Parent 96bc56916c955098f4a5b71cc174edeef1f090d9 [FT-70] #5329 and issue #5647 Revise handling of empty chunks in yaesu_clone.py #5647 Empty chunks no longer counted towards blocks read. #5329 Can now set correct memory size read request, as no getting empty blocks. Yaesu_clone change proposed by Dan - Thanks! I have only tested it on the FT-70, would be great to see it tested on other Yaesu radios. This replaces my last submitted patch.
diff -r 96bc56916c95 -r 9e3b0ff76308 chirp/drivers/ft70.py --- a/chirp/drivers/ft70.py Tue Mar 20 21:38:07 2018 -0400 +++ b/chirp/drivers/ft70.py Fri Mar 23 17:52:01 2018 +0000 @@ -466,14 +466,14 @@ @directory.register class FT70Radio(yaesu_clone.YaesuCloneModeRadio): """Yaesu FT-70DE""" - BAUD_RATE = 115200 + BAUD_RATE = 38400 VENDOR = "Yaesu" MODEL = "FT-70D"
_model = "AH51G"
- _memsize = 65227 # 65227 read from dump ? - _block_lengths = [10, 65555] # ????? Not sure why this works to match _memsize + _memsize = 65227 # 65227 read from dump + _block_lengths = [10, 65217] _block_size = 32 _mem_params = (900, # size of memories array 900, # size of flags array diff -r 96bc56916c95 -r 9e3b0ff76308 chirp/drivers/yaesu_clone.py --- a/chirp/drivers/yaesu_clone.py Tue Mar 20 21:38:07 2018 -0400 +++ b/chirp/drivers/yaesu_clone.py Fri Mar 23 17:52:01 2018 +0000 @@ -43,14 +43,22 @@
def _chunk_read(pipe, count, status_fn): + timer = time.time() block = 32 data = "" - for _i in range(0, count, block): - data += pipe.read(block) - if data: + while len(data) < count: + # Don't read past the end of our block if we're not on a 32-byte boundary + chunk_size = min(block, count - len(data)) + chunk = pipe.read(chunk_size) + if chunk: + timer = time.time() + data += chunk if data[0] == chr(CMD_ACK): data = data[1:] # Chew an echo'd ack if using a 2-pin cable - # LOG.debug("Chewed an ack") + # LOG.debug("Chewed an ack") + if time.time() - timer > 2: + # It's been two seconds since we last saw data from the radio, so it's time to give up. + raise errors.RadioError("Timed out reading from radio") status = chirp_common.Status() status.msg = "Cloning from radio" status.max = count