From a3aae7a14e0281546cd7c853f5e6b3c1abc6c82d Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 28 May 2023 15:56:49 +0930 Subject: [PATCH] Only send landing notifications if sonde has gone above the landing alt threshold first. --- auto_rx/autorx/__init__.py | 2 +- auto_rx/autorx/config.py | 2 +- auto_rx/autorx/email_notification.py | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index 8f2083b3..efa39576 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -12,7 +12,7 @@ # 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 diff --git a/auto_rx/autorx/config.py b/auto_rx/autorx/config.py index 15a3ec9b..d35fa3bb 100644 --- a/auto_rx/autorx/config.py +++ b/auto_rx/autorx/config.py @@ -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: diff --git a/auto_rx/autorx/email_notification.py b/auto_rx/autorx/email_notification.py index 077132de..4a8f972c 100644 --- a/auto_rx/autorx/email_notification.py +++ b/auto_rx/autorx/email_notification.py @@ -121,6 +121,7 @@ def process_telemetry(self, telemetry): 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 @@ def process_telemetry(self, telemetry): # 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