FlightDetector

high alt detection
This commit is contained in:
SpudGunMan
2025-05-21 16:18:46 -07:00
parent d055c35c96
commit feb9a1d9b3
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -235,6 +235,7 @@ try:
sentryIgnoreList = config['sentry'].get('sentryIgnoreList', '').split(',')
sentry_radius = config['sentry'].getint('SentryRadius', 100) # default 100 meters
email_sentry_alerts = config['sentry'].getboolean('emailSentryAlerts', False) # default False
highfly_enabled = config['sentry'].getboolean('highFlyingAlert', True) # default True
# location
location_enabled = config['location'].getboolean('enabled', True)
+7
View File
@@ -978,6 +978,13 @@ def consumeMetadata(packet, rxNode=0):
for key in keys:
positionMetadata[nodeID][key] = position_data.get(key, 0)
# if altitude is over 2000 send a log and message for high-flying nodes
if position_data.get('altitude', 0) > 2000 and highfly_enabled:
logger.warning(f"System: High Altitude {position_data['altitude']}m on Device: {rxNode} NodeID: {nodeID}")
if antiSpam and nodeID != globals().get(f'myNodeNum{rxNode}'):
send_message(f"High Altitude {position_data['altitude']}m on Device: {rxNode} NodeID: {nodeID}", secure_channel, 0, rxNode)
time.sleep(responseDelay)
# Keep the positionMetadata dictionary at a maximum size of 20
if len(positionMetadata) > 20: