From 4f6d74a19dbb627fcf1538c16edb66bb405a61c7 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 6 Oct 2024 16:48:33 -0700 Subject: [PATCH] fix --- mesh_bot.py | 2 +- modules/system.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index ba3ea04..84bbf76 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -956,7 +956,7 @@ def onReceive(packet, interface): localStats = telemetry_packet['localStats'] if localStats.get('numPacketsTx') and localStats.get('numPacketsRx') != 0: if numPacketsRx != 0: - print(f"injest numPacketsTx, numPacketsRx, numPacketsTxErr, numPacketsRxErr: {numPacketsTx}, {numPacketsRx}, {numPacketsTxErr}, {numPacketsRxErr}") + print(f"packet {telemetry_packet}") # Assign the values and include rxNode numPacketsTx = (localStats['numPacketsTx'], rxNode) numPacketsRx = (localStats['numPacketsRx'], rxNode) diff --git a/modules/system.py b/modules/system.py index 46c9c86..02ac258 100644 --- a/modules/system.py +++ b/modules/system.py @@ -669,15 +669,15 @@ def getNodeFirmware(nodeID=0, nodeInt=1): return -1 return fwVer -def getNodeTelemetry(nodeID=0, rxNode=1): +def getNodeTelemetry(nodeID=0, rxNode=0): global lastTelemetryRequest, numPacketsTx, numPacketsRx, numPacketsTxErr, numPacketsRxErr # throttle the telemetry requests to prevent spamming the device if time.time() - lastTelemetryRequest < 1200: - print(f"watchDog numPacketsTx, numPacketsRx, numPacketsTxErr, numPacketsRxErr: {numPacketsTx}, {numPacketsRx}, {numPacketsTxErr}, {numPacketsRxErr}") + if numPacketsRx[1] != -1: + print(f"watchDog numPacketsTx, numPacketsRx, numPacketsTxErr, numPacketsRxErr: {numPacketsTx}, {numPacketsRx}, {numPacketsTxErr}, {numPacketsRxErr}") return -1 lastTelemetryRequest = time.time() # get the telemetry data for a node - dataResponse = "" if rxNode == 1: chutil = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("channelUtilization", 0), 1) airUtilTx = round(interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("airUtilTx", 0), 1) @@ -699,14 +699,14 @@ def getNodeTelemetry(nodeID=0, rxNode=1): else: return -1 + dataResponse = f"Telemetry:{rxNode} " + # packet telemetry - if numPacketsRx != 0: - print(f"set new value numPacketsTx, numPacketsRx, numPacketsTxErr, numPacketsRxErr: {numPacketsTx}, {numPacketsRx}, {numPacketsTxErr}, {numPacketsRxErr}") - if numPacketsTx[1] == 1: - dataResponse += f"Telemetry:{rxNode} numPacketsTx:{numPacketsTx[0]} numPacketsRx:{numPacketsRx[0]} numPacketsTxErr:{numPacketsTxErr[0]} numPacketsRxErr:{numPacketsRxErr[0]}" - elif numPacketsTx[1] == 2: - dataResponse += f"Telemetry:{rxNode} numPacketsTx:{numPacketsTx[0]} numPacketsRx:{numPacketsRx[0]} numPacketsTxErr:{numPacketsTxErr[0]} numPacketsRxErr:{numPacketsRxErr[0]} " - + if numPacketsTx[1] == 1: + dataResponse += f" numPacketsTx:{numPacketsTx[0]} numPacketsRx:{numPacketsRx[0]} numPacketsTxErr:{numPacketsTxErr[0]} numPacketsRxErr:{numPacketsRxErr[0]}" + elif numPacketsTx[1] == 2: + dataResponse += f" numPacketsTx:{numPacketsTx[0]} numPacketsRx:{numPacketsRx[0]} numPacketsTxErr:{numPacketsTxErr[0]} numPacketsRxErr:{numPacketsRxErr[0]} " + # Channel utilization and airUtilTx dataResponse += " ChUtil%:" + str(round(chutil, 2)) + " AirTx%:" + str(round(airUtilTx, 2))