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):
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:
del poslist[key]
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:
del poslist[key]

View File

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

View File

@ -93,8 +93,9 @@ class output_sbs1:
try:
sbs1_msg = self.parse(msg)
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
conn.send(sbs1_msg)
conn.send(sbs1_bytes)
except socket.error:
self._conns.remove(conn)
print("Connections: ", len(self._conns))