From eac070033816139f8dc135bddf5c7f9d5846e78c Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 8 Oct 2024 16:18:16 -0700 Subject: [PATCH] Update system.py --- modules/system.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/system.py b/modules/system.py index 45e3f2d..1c782af 100644 --- a/modules/system.py +++ b/modules/system.py @@ -742,7 +742,7 @@ def consumeMetadata(packet, rxNode=0): if telemetry_packet.get('localStats'): localStats = telemetry_packet['localStats'] # Check if 'numPacketsTx' and 'numPacketsRx' exist and are not zero - if localStats.get('numPacketsTx') is not None and localStats.get('numPacketsRx') is not None and localStats['numPacketsTx'] != -1: + if localStats.get('numPacketsTx') is not None and localStats.get('numPacketsRx') is not None and localStats['numPacketsTx'] != 0: # Assign the values to the telemetry dictionary if localStats.get('numPacketsTx') is not None: telemetryData[rxNode]['numPacketsTx'] = localStats.get('numPacketsTx') @@ -764,11 +764,11 @@ def consumeMetadata(packet, rxNode=0): 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']['altitude'] + altitude = packet['decoded']['position'].get('altitude', 0) if packet['decoded']['position']['groundSpeed'] is not None: - groundSpeed = packet['decoded']['position']['groundSpeed'] + groundSpeed = packet['decoded']['position'].get('groundSpeed', 0) if packet['decoded']['position']['precisionBits'] is not None: - precisionBits = packet['decoded']['position']['precisionBits'] + precisionBits = packet['decoded']['position'].get('precisionBits', 0) # put data into positionMetadata and keep it at 5 records if len(positionMetadata) > 5: positionMetadata.pop(0)