From 6122df060022e40c389c17b36b8c93762160af88 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 26 Mar 2024 12:36:56 +0100 Subject: [PATCH] Added support for location provider plugins --- sbapp/sideband/sense.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sbapp/sideband/sense.py b/sbapp/sideband/sense.py index 1eb8ba0..abb3c5e 100644 --- a/sbapp/sideband/sense.py +++ b/sbapp/sideband/sense.py @@ -620,6 +620,7 @@ class Location(Sensor): self._min_distance = Location.MIN_DISTANCE self._accuracy_target = Location.ACCURACY_TARGET self._query_method = None + self._synthesized_updates = False self.latitude = None self.longitude = None @@ -679,16 +680,21 @@ class Location(Sensor): self._raw = kwargs self._last_update = time.time() + def set_update_time(self, update_time): + self._synthesized_updates = True + self._last_update = update_time + def update_data(self): try: if self.synthesized: if self.latitude != None and self.longitude != None: now = time.time() - if self._last_update == None: - self._last_update = now - elif now > self._last_update + self._stale_time: - self._last_update = now + if not self._synthesized_updates: + if self._last_update == None: + self._last_update = now + elif now > self._last_update + self._stale_time: + self._last_update = now if self.altitude == None: self.altitude = 0.0 if self.accuracy == None: self.accuracy = 0.01