From ac4ae3bbf16126d9bb130b6bd0db3a677c831d96 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 4 Nov 2024 04:51:48 -0600 Subject: [PATCH] Rework logic to prevent spammy router logs --- src/mesh/MeshService.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 0fb131b145..8efff3d329 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -79,14 +79,15 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp) powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping nodeDB->updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio + bool isPreferredRebroadcaster = + IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_REPEATER); if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp->decoded.portnum == meshtastic_PortNum_TELEMETRY_APP && mp->decoded.request_id > 0) { LOG_DEBUG("Received telemetry response. Skip sending our NodeInfo."); // because this potentially a Repeater which will // ignore our request for its NodeInfo } else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user && - nodeInfoModule) { - if (airTime->isTxAllowedChannelUtil(true) && !IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER, - meshtastic_Config_DeviceConfig_Role_REPEATER)) { + nodeInfoModule && !isPreferredRebroadcaster) { + if (airTime->isTxAllowedChannelUtil(true)) { LOG_INFO("Heard new node on channel %d, sending NodeInfo and asking for a response.", mp->channel); nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel); } else {