From 5bf1ade2b0502d011b987919fac6dc3f2964db1d Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 23 Oct 2025 12:10:45 -0700 Subject: [PATCH] enhance --- mesh_bot.py | 2 +- modules/locationdata.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 2b81ed4..ad3063b 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -68,7 +68,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "leaderboard": lambda: get_mesh_leaderboard(message, message_from_id, deviceID), "lemonstand": lambda: handleLemonade(message, message_from_id, deviceID), "lheard": lambda: handle_lheard(message, message_from_id, deviceID, isDM), - "map": lambda: mapHandler(message_from_id, deviceID, channel_number, message), + "map": lambda: mapHandler(message_from_id, deviceID, channel_number, message, snr, rssi, hop), "mastermind": lambda: handleMmind(message, message_from_id, deviceID), "messages": lambda: handle_messages(message, deviceID, channel_number, msg_history, publicChannel, isDM), "moon": lambda: handle_moon(message_from_id, deviceID, channel_number), diff --git a/modules/locationdata.py b/modules/locationdata.py index bc22912..1f23afe 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -1097,7 +1097,7 @@ def log_locationData_toMap(userID, location, message): logger.error(f"Failed to log location for {userID}: {e}") return False -def mapHandler(userID, deviceID, channel_number, message): +def mapHandler(userID, deviceID, channel_number, message, snr, rssi, hop): from modules.system import get_node_location command = message[len("map"):].strip() location = get_node_location(userID, deviceID) @@ -1123,6 +1123,14 @@ def mapHandler(userID, deviceID, channel_number, message): if description and description[0] in ('=', '+', '-', '@'): description = "'" + description + # if there is SNR and RSSI info, append to description + if snr is not None and rssi is not None: + description += f" (SNR:{snr}dB RSSI:{rssi}dBm" + + # if there is hop info, append to description + if hop is not None: + description += f" Meta:{hop})" + # location should be a tuple: (lat, lon) if not location or len(location) != 2: return "🚫Location data is missing or invalid."