Merge pull request #109 from jaredd/master

Fix python3 error w.r.t. modifying a list in place. Also fix SBS1 interface. Author: Jared Dulmage/github.com/jaredd
This commit is contained in:
Nick Foster 2020-05-06 09:39:40 -07:00 committed by GitHub
commit 9e2515a566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -193,11 +193,11 @@ class cpr_decoder:
def weed_poslists(self): def weed_poslists(self):
for poslist in [self.evenlist, self.oddlist]: for poslist in [self.evenlist, self.oddlist]:
for key, item in poslist.items(): for key, item in tuple(poslist.items()):
if time.time() - item[2] > 10: if time.time() - item[2] > 10:
del poslist[key] del poslist[key]
for poslist in [self.evenlist_sfc, self.oddlist_sfc]: for poslist in [self.evenlist_sfc, self.oddlist_sfc]:
for key, item in poslist.items(): for key, item in tuple(poslist.items()):
if time.time() - item[2] > 25: if time.time() - item[2] > 25:
del poslist[key] del poslist[key]

View File

@ -80,7 +80,7 @@ class output_print:
except ADSBError: except ADSBError:
return return
if msg.data["vs"] is 1: if msg.data["vs"] == 1:
retstr += " (aircraft is on the ground)" retstr += " (aircraft is on the ground)"
self._print(retstr) self._print(retstr)

View File

@ -93,8 +93,9 @@ class output_sbs1:
try: try:
sbs1_msg = self.parse(msg) sbs1_msg = self.parse(msg)
if sbs1_msg is not None: if sbs1_msg is not None:
sbs1_bytes = sbs1_msg.encode('utf-8')
for conn in self._conns[:]: #iterate over a copy of the list for conn in self._conns[:]: #iterate over a copy of the list
conn.send(sbs1_msg) conn.send(sbs1_bytes)
except socket.error: except socket.error:
self._conns.remove(conn) self._conns.remove(conn)
print("Connections: ", len(self._conns)) print("Connections: ", len(self._conns))