From 1b1861c7a23c39e201b24ff8888d08b35358eb15 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 8 Oct 2024 16:39:49 -0700 Subject: [PATCH] fix --- modules/games/joke.py | 2 +- modules/system.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/games/joke.py b/modules/games/joke.py index 621f071..334593b 100644 --- a/modules/games/joke.py +++ b/modules/games/joke.py @@ -24,7 +24,7 @@ def sendWithEmoji(message): 'surfing': '๐Ÿ„', 'swimming': '๐ŸŠ', 'water polo': '๐Ÿคฝ', 'cycling': '๐Ÿšด', 'mountain biking': '๐Ÿšต', 'horse riding': '๐Ÿ‡', 'kneeling': '๐ŸงŽ', 'weightlifting': '๐Ÿ‹๏ธ', 'gymnastics': '๐Ÿคธ', 'wrestling': '๐Ÿคผ', 'handball': '๐Ÿคพ', 'juggling': '๐Ÿคน', 'meditation': '๐Ÿง˜', 'sauna': '๐Ÿง–', 'rock climbing': '๐Ÿง—', 'stop': '๐Ÿ›‘' } - + # type format to clean it up words = message.lower().split() words = words.replace('.', '').replace(',', '').replace('!', '').replace('?', '') i = 0 diff --git a/modules/system.py b/modules/system.py index 1c782af..3e11bdf 100644 --- a/modules/system.py +++ b/modules/system.py @@ -763,16 +763,17 @@ def consumeMetadata(packet, rxNode=0): if packet_type == 'POSITION_APP': if debugMetadata: print(f"DEBUG POSITION_APP: {packet}\n\n") # get the position data - if packet['decoded']['position']['altitude'] is not None: - altitude = packet['decoded']['position'].get('altitude', 0) - if packet['decoded']['position']['groundSpeed'] is not None: - groundSpeed = packet['decoded']['position'].get('groundSpeed', 0) - if packet['decoded']['position']['precisionBits'] is not None: - precisionBits = packet['decoded']['position'].get('precisionBits', 0) + keys = ['altitude', 'groundSpeed', 'precisionBits'] + position_data = packet['decoded']['position'] + for key in keys: + # add the position data to the positionMetadata dictionary + if nodeID not in positionMetadata: + positionMetadata[nodeID] = {} + positionMetadata[nodeID][key] = position_data[key] + # put data into positionMetadata and keep it at 5 records if len(positionMetadata) > 5: positionMetadata.pop(0) - positionMetadata.append({'nodeID': nodeID, 'altitude': altitude, 'groundSpeed': groundSpeed, 'precisionBits': precisionBits}) print(f"DEBUG POSITION_METADATA: {positionMetadata}\n\n") # WAYPOINT_APP packets