From b53f5821f355431048800b631fd7388e2be90457 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 14 Oct 2025 10:51:34 -0700 Subject: [PATCH] Update system.py --- modules/system.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/system.py b/modules/system.py index 2606d46..8740c35 100644 --- a/modules/system.py +++ b/modules/system.py @@ -1419,8 +1419,18 @@ def consumeMetadata(packet, rxNode=0, channel=-1): # check get_openskynetwork to see if the node is an aircraft if 'latitude' in position_data and 'longitude' in position_data: flight_info = get_openskynetwork(position_data.get('latitude', 0), position_data.get('longitude', 0)) - if flight_info and NO_ALERTS not in flight_info and ERROR_FETCHING_DATA not in flight_info: - msg += f"\n✈️Detected near:\n{flight_info}" + # Only show plane if within altitude + if ( + flight_info + and NO_ALERTS not in flight_info + and ERROR_FETCHING_DATA not in flight_info + and isinstance(flight_info, dict) + and 'altitude' in flight_info + ): + plane_alt = flight_info['altitude'] + node_alt = position_data.get('altitude', 0) + if abs(node_alt - plane_alt) <= 600: # within 600m + msg += f"\n✈️Detected near:\n{flight_info}" send_message(msg, highfly_channel, 0, highfly_interface) # Keep the positionMetadata dictionary at a maximum size if len(positionMetadata) > MAX_SEEN_NODES: