[chirp_devel] [PATCH 1 of 2] ap510: Handle uninitialized data in the digipeat alias. #2095
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1418966149 28800 # Thu Dec 18 21:15:49 2014 -0800 # Node ID dab6a8e2a7666c3beea65f4831f9c7161c648092 # Parent b67507019c2b8d7fa250c624eb72e04ef112904c ap510: Handle uninitialized data in the digipeat alias. #2095
diff -r b67507019c2b -r dab6a8e2a766 chirp/ap510.py --- a/chirp/ap510.py Sun Dec 14 15:45:10 2014 -0800 +++ b/chirp/ap510.py Thu Dec 18 21:15:49 2014 -0800 @@ -355,12 +355,17 @@ for field in fields: china.append(RadioSetting(*field))
+ try: + # Sometimes when digipeat is disabled, alias is 0xFF + alias = ALIAS[int(self._mmap.digipeat[1]) - 1] + except ValueError: + alias = ALIAS[0] fields = [ ("digipeat", "Digipeat", RadioSettingValueBoolean(strbool(self._mmap.digipeat[0]))), ("alias", "Digipeat Alias", RadioSettingValueList( - ALIAS, ALIAS[int(self._mmap.digipeat[1]) - 1])), + ALIAS, alias)), ("virtualgps", "Static Position", RadioSettingValueBoolean(strbool(self._mmap.virtualgps[0]))), ("btext", "Static Position BTEXT", RadioSettingValueString(
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1418966151 28800 # Thu Dec 18 21:15:51 2014 -0800 # Node ID c152bca4fd0352de559496a7705186707e0111b8 # Parent dab6a8e2a7666c3beea65f4831f9c7161c648092 ap510: Wait longer for data during download. #2095
diff -r dab6a8e2a766 -r c152bca4fd03 chirp/ap510.py --- a/chirp/ap510.py Thu Dec 18 21:15:49 2014 -0800 +++ b/chirp/ap510.py Thu Dec 18 21:15:51 2014 -0800 @@ -86,11 +86,17 @@ status.msg = "Downloading" radio.status_fn(status) radio.pipe.write("@DISP") - buf = radio.pipe.read(1024) + buf = ""
- status.cur = 5 - status.max = 5 - radio.status_fn(status) + for status.cur in xrange(status.cur, status.max): + buf += radio.pipe.read(1024) + if buf.endswith("\r\n"): + status.cur = status.max + radio.status_fn(status) + break + radio.status_fn(status) + else: + raise errors.RadioError("Incomplete data received.")
print "%04i P<R: %s" % ( len(buf), util.hexprint(buf).replace("\n", "\n "))
participants (1)
-
Tom Hayward