This commit is contained in:
SpudGunMan
2024-10-08 16:39:49 -07:00
parent f3dc72b234
commit 1b1861c7a2
2 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -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
+8 -7
View File
@@ -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