diff -r add6ffb41cb3 chirp/drivers/btech.py --- a/chirp/drivers/btech.py Fri Apr 01 18:20:53 2022 -0400 +++ b/chirp/drivers/btech.py Fri Apr 01 22:01:38 2022 -0400 @@ -359,26 +359,11 @@ return data -def _send(radio, data, upload=False): +def _send(radio, data): """Send data to the radio device""" try: - for byte in data: - radio.pipe.write(byte) - # Some OS (mainly Linux ones) are too fast on the serial and - # get the MCU inside the radio stuck in the early stages, this - # hits some models more than others. - # - # To cope with that we introduce a delay on the writes. - # Many option have been tested (delaying only after error occures, - # after short reads, only for linux, ...) - # Finally, a static delay was chosen as simplest of all solutions - # (Michael Wagner, OE4AMW) - # (for details, see issue 3993) - # - # skip 'sleep()' when uploading added by Jim Unroe, KC9HI - if upload is False: - sleep(0.002) + radio.pipe.write(data) # DEBUG if debug is True: @@ -507,9 +492,6 @@ # some radios needs a extra read and check for a code on it, this ones # has the check value in the _id2 var, others simply False if radio._id2 is not False: - # lower the timeout here as this radios are reseting due to timeout - radio.pipe.timeout = 0.05 - # query & receive the extra ID _send(radio, _make_frame("S", 0x3DF0, 16)) id2 = _rawrecv(radio, 21) @@ -558,9 +540,6 @@ if len(ack) == 0 or ack[-1:] != ACK_CMD: raise errors.RadioError("Radio didn't ACK the upload") - # restore the default serial timeout - radio.pipe.timeout = STIMEOUT - # DEBUG LOG.info("Positive ident, this is a %s %s" % (radio.VENDOR, radio.MODEL)) @@ -576,6 +555,9 @@ # put radio in program mode and identify it _do_ident(radio, status) + # pause here for the radio to catch up + sleep(0.002) + # the models that doesn't have the extra ID have to make a dummy read here if radio._id2 is False: _send(radio, _make_frame("S", 0, BLOCK_SIZE)) @@ -656,7 +638,7 @@ frame = frame[1:] # send the frame - _send(radio, frame, True) + _send(radio, frame) # receiving the response ack = _rawrecv(radio, 1)