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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
9fcb289643
commit
74119c088b
1 file changed
+6
-2
+6
-2
@@ -16,7 +16,7 @@
|
||||
#include <ErriezCRC32.h>
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
#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;
|
||||
|
||||
Reference in New Issue
Block a user