From 082652e45850fe161d6cfbb065ecdc879c81dc1c Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 19 Jun 2024 12:38:33 -0700 Subject: [PATCH] Update mesh-bot.py --- mesh-bot.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mesh-bot.py b/mesh-bot.py index 1517601..709261d 100644 --- a/mesh-bot.py +++ b/mesh-bot.py @@ -115,18 +115,18 @@ def onReceive(packet, interface): else: hop_start = 0 - if hop_start == hop_limit: - hop = "Direct" + if hop_start == hop_limit: + hop = "Direct" + else: + # set hop to Direct if the message was sent directly otherwise set the hop count + if hop_away > 0: + hop_count = hop_away + print (f"Using hopsAway: {hop_count}") else: - # set hop to Direct if the message was sent directly otherwise set the hop count - if hop_away > 0: - hop_count = hop_away - print (f"Using hopsAway: {hop_count}") - else: - hop_count = hop_start - hop_limit - print (f"calculated hop count: {hop_start} - {hop_limit} = {hop_count}") + hop_count = hop_start - hop_limit + print (f"calculated hop count: {hop_start} - {hop_limit} = {hop_count}") - hop = f"{hop_count} hops" + hop = f"{hop_count} hops" # If the packet is a DM (Direct Message) respond to it, otherwise validate its a message for us if packet['to'] == myNodeNum: