Add data recheck on feeding status change.
This commit is contained in:
parent
5e9b9e5a76
commit
6fe6de8857
|
@ -18,6 +18,8 @@ class Plane:
|
|||
self.map_file_name = icao.upper() + "_map.png"
|
||||
self.last_latitude = None
|
||||
self.last_longitude = None
|
||||
self.recheck_needed = None
|
||||
self.last_recheck_needed = None
|
||||
def getICAO(self):
|
||||
return self.icao
|
||||
def run(self, ac_dict):
|
||||
|
@ -60,8 +62,6 @@ class Plane:
|
|||
self.pb = Pushbullet(self.config['PUSHBULLET']['API_KEY'])
|
||||
self.pb_channel = self.pb.get_channel(self.config.get('PUSHBULLET', 'CHANNEL_TAG'))
|
||||
|
||||
#Pre Set Non Reseting Variables
|
||||
|
||||
print (Back.MAGENTA, "---------", self.conf_file, "---------------------------- ICAO:", self.icao, "--------------------------", Style.RESET_ALL)
|
||||
#Reset Variables
|
||||
self.below_desired_ft = None
|
||||
|
@ -131,8 +131,28 @@ class Plane:
|
|||
print ("Longitude: ", self.longitude)
|
||||
print ("GEO Alitude Ft: ", self.geo_alt_ft)
|
||||
print(Style.RESET_ALL)
|
||||
#Set Check for inconsistancy in data
|
||||
if not self.last_recheck_needed:
|
||||
#Recheck needed if feeding state changes
|
||||
if self.feeding != self.last_feeding:
|
||||
self.recheck_needed = True
|
||||
print("Recheck needed, feeding status changed")
|
||||
elif self.last_recheck_needed:
|
||||
self.recheck_needed = False
|
||||
|
||||
|
||||
#Run a Check compares new data to last flagged(check) data
|
||||
if self.last_recheck_needed:
|
||||
if self.recheck_feeding == self.feeding:
|
||||
print("Data Feeding change Consistent")
|
||||
elif self.recheck_feeding != self.feeding:
|
||||
print("Data Feeding change was Inconsistent last data ignored")
|
||||
|
||||
self.recheck_feeding = self.feeding
|
||||
self.last_recheck_needed = self.recheck_needed
|
||||
|
||||
if self.recheck_needed is False:
|
||||
|
||||
#Check if below desire ft
|
||||
if self.geo_alt_ft is None:
|
||||
self.below_desired_ft = False
|
||||
|
|
Loading…
Reference in New Issue