From 4748d06de709f2d3d94ec14cf6283a8f025a7c0c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 6 Apr 2021 20:39:11 -0500 Subject: [PATCH] Fixed bug from issue #3, where old updates would get re-published due to a bad condition on an if statement. Also fixed design flaw where None was sometimes returned from getEvents(), causing trouble in the event-handling loop. There is now always a list of events; it should just be empty in every case where we don't find current data. --- ir-aprsisd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ir-aprsisd b/ir-aprsisd index 8b49a6b..430654e 100755 --- a/ir-aprsisd +++ b/ir-aprsisd @@ -258,12 +258,12 @@ def getEvents(): KML = http.open(conf['inReach']['URL']).read() except Exception as e: print("Error reading URL: " + conf['inReach']['URL']) - return None + return events try: data = xml.dom.minidom.parseString(KML).documentElement except Exception as e: print("Can't process KML feed on this pass.") - return None + return events #The first placemark will have the expanded current location information. for PM in data.getElementsByTagName('Placemark'): res = parsePlacemark(PM) @@ -316,7 +316,7 @@ def sendAPRS(device, DevID, ARPreamble, tstamp, lat, long, alt, course, speed, c aprsPacket = ''.join([getSSID(DevID),ARPreamble, ':@', time.strftime("%d%H%Mz",tstamp), pos]) #Check to make sure the update is new: - if lastUpdate[DevID] > etime: + if not etime > lastUpdate[DevID]: return None #In theory a course/speed of 000/000 sholdn't be much different