From 74119c088b6ca1e7c8febfec843363c949cf8f01 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 18 Aug 2026 20:44:48 -0500 Subject: [PATCH] fix(mesh): don't reference the position module on MESHTASTIC_EXCLUDE_GPS builds The event-channel position-request reply added in #11545 calls positionModule-> replyOnPositionChannel() guarded only by USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL. Targets that set MESHTASTIC_EXCLUDE_GPS (repeaters such as rak_wismesh_repeater_mini_hp) never construct PositionModule in Modules.cpp, so an event build for one of those fails to link: undefined reference to `PositionModule::replyOnPositionChannel(...)' undefined reference to `positionModule' Guard the call, the include and the isEventChannelPositionRequestForUs() helper with !MESHTASTIC_EXCLUDE_GPS, matching how AdminModule guards its positionModule use. A node with no position module has nothing to answer a position request with, so skipping the reply is the correct behavior there. Not reachable on develop, where the userpref defaults off and the whole block compiles out - it only breaks builds that enable it, which is why #11545 was green. Verified by building rak_wismesh_repeater_mini_hp with the pref enabled. Co-Authored-By: Claude Fable 5 --- src/mesh/Router.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 02e85b62d..34f477438 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -16,7 +16,7 @@ #include #include #include -#if USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL +#if USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL && !MESHTASTIC_EXCLUDE_GPS #include "modules/PositionModule.h" #endif #if HAS_TRAFFIC_MANAGEMENT @@ -104,7 +104,7 @@ bool isBlockedEventCoordinatePacket(const meshtastic_MeshPacket *p) #endif } -#if USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL +#if USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL && !MESHTASTIC_EXCLUDE_GPS // A remote node's unicast position request to us. Only the reply is generated for these; the packet // itself is still dropped by the caller. static bool isEventChannelPositionRequestForUs(const meshtastic_MeshPacket *p) @@ -1561,8 +1561,12 @@ void Router::dispatchReceived(meshtastic_MeshPacket *p, RxSource src) // channel's precision, so "request position" from a node that only shares the event channel // with us resolves where positions actually live. The requester's own coordinates are // still dropped: not stored, not forwarded to the phone, not relayed, not published. + // Builds without the position module (MESHTASTIC_EXCLUDE_GPS, e.g. repeaters) have nothing + // to answer with, and neither the symbol nor the global exists to link against. +#if !MESHTASTIC_EXCLUDE_GPS if (isEventChannelPositionRequestForUs(p) && positionModule) positionModule->replyOnPositionChannel(*p); +#endif LOG_DEBUG("Drop coordinate packet on event (everyone) channel"); cancelSending(p->from, p->id); skipHandle = true;