Only send landing notifications if sonde has gone above the landing alt threshold first.

pull/776/head
Mark Jessop 2023-05-28 15:56:49 +09:30
rodzic 6e098108ab
commit a3aae7a14e
3 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ from queue import Queue
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.
__version__ = "1.6.2-beta2"
__version__ = "1.6.2-beta3"
# Global Variables

Wyświetl plik

@ -683,7 +683,7 @@ def read_auto_rx_config(filename, no_sdr_test=False):
# that this goes against the wishes of the radiosonde_auto_rx developers to not be part
# of the bigger problem of APRS-IS congestion.
ALLOWED_APRS_SERVERS = ["radiosondy.info"]
ALLOWED_APRS_SERVERS = ["radiosondy.info", "localhost"]
ALLOWED_APRS_PORTS = [14590]
if auto_rx_config["aprs_server"] not in ALLOWED_APRS_SERVERS:

Wyświetl plik

@ -121,6 +121,7 @@ class EmailNotification(object):
self.sondes[_id] = {
"last_time": time.time(),
"descending_trip": 0,
"ascent_trip": False,
"descent_notified": False,
"track": GenericTrack(max_elements=20),
}
@ -224,14 +225,21 @@ class EmailNotification(object):
# We have seen this sonde recently. Let's check it's descending...
if self.sondes[_id]["descent_notified"] == False and _sonde_state:
# Set a flag if the sonde has passed above the landing altitude threshold.
# This is used along with the descending trip to trigger a landing email notification.
if (telemetry["alt"] > self.landing_altitude_threshold):
self.sondes[_id]["ascent_trip"] = True
# If the sonde is below our threshold altitude, *and* is descending at a reasonable rate, increment.
if (telemetry["alt"] < self.landing_altitude_threshold) and (
_sonde_state["ascent_rate"] < -2.0
):
self.sondes[_id]["descending_trip"] += 1
if self.sondes[_id]["descending_trip"] > self.landing_descent_trip:
# We've seen this sonde descending for enough time now.
if (self.sondes[_id]["descending_trip"] > self.landing_descent_trip) and self.sondes[_id]["ascent_trip"]:
# We've seen this sonde descending for enough time now AND we have also seen it go above the landing threshold,
# so it's likely been on a flight and isnt just bouncing around on the ground.
# Note that we've passed the descent threshold, so we shouldn't analyze anything from this sonde anymore.
self.sondes[_id]["descent_notified"] = True