Now removing cached repeaters file when receiver location moves.

This commit is contained in:
Marat Fayzullin 2024-05-25 21:26:07 -04:00
parent d050c15c9a
commit a0b2a85ee2
4 changed files with 21 additions and 2 deletions

View File

@ -3,6 +3,7 @@
- Added copyright-free Mirics driver for SDRPlay and clones.
- Fixed OpenWebRX startup failure if MQTT connection fails.
- Volume control is now logarithmic, in -55db to +5db range.
- Removing repeaters.json when receiver moves by >10km.
- Added Aircraft Emergency Frequency bookmark.
**1.2.58**

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ openwebrx (1.2.59) bullseye jammy; urgency=low
* Added copyright-free Mirics driver for SDRPlay and clones.
* Fixed OpenWebRX startup failure if MQTT connection fails.
* Volume control is now logarithmic, in -55db to +5db range.
* Removing repeaters.json when receiver moves by >10km.
* Added Aircraft Emergency Frequency bookmark.
-- Marat Fayzullin <luarvique@gmail.com> Mon, 27 May 2024 16:12:00 +0000

View File

@ -56,8 +56,7 @@ class GpsUpdater(object):
self.event = threading.Event()
self.thread = None
# Start/stop main thread when setting changes
pm = Config.get()
pm.wireProperty("gps_updates", self._toggleUpdates)
Config.get().wireProperty("gps_updates", self._toggleUpdates)
# Toggle GPS updates when setting changes
def _toggleUpdates(self, enable):

View File

@ -74,6 +74,24 @@ class Repeaters(object):
self.refreshPeriod = 60*60*24
self.lock = threading.Lock()
self.repeaters = []
# Update repeater list when receiver location changes
pm = Config.get()
self.location = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"])
pm.wireProperty("receiver_gps", self._updateLocation)
# Delete current repeater list when receiver location changes.
def _updateLocation(self, location):
location = (location["lat"], location["lon"])
file = self._getCachedDatabaseFile()
dist = self.distKm(location, self.location)
if not os.path.exists(file):
# If there are no repeaters loaded, just keep new location
self.location = location
elif dist > 10:
# Do not delete repeater list unless receiver moved a lot
logger.debug("Receiver moved by {0}km, deleting '{1}'...".format(dist, file))
self.location = location
os.remove(file)
#
# Load cached database or refresh it from the web.