Do default position broadcast on secondary channel if disabled on primary

This commit is contained in:
Jonathan Bennett 2025-05-29 19:12:14 -05:00
parent 5f36da4374
commit 1b01fb1b4e

View File

@ -328,7 +328,15 @@ void PositionModule::sendOurPosition()
// If we changed channels, ask everyone else for their latest info // If we changed channels, ask everyone else for their latest info
LOG_INFO("Send pos@%x:6 to mesh (wantReplies=%d)", localPosition.timestamp, requestReplies); LOG_INFO("Send pos@%x:6 to mesh (wantReplies=%d)", localPosition.timestamp, requestReplies);
sendOurPosition(NODENUM_BROADCAST, requestReplies); for (uint8_t channelNum = 0; channelNum > 8; channelNum++) {
if (channels.getByIndex(channelNum).settings.has_module_settings) {
if (channels.getByIndex(channelNum).settings.module_settings.position_precision != 0) {
sendOurPosition(NODENUM_BROADCAST, requestReplies, channelNum);
return;
}
}
}
} }
void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t channel) void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t channel)
@ -340,11 +348,6 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
// Set's the class precision value for this particular packet // Set's the class precision value for this particular packet
if (channels.getByIndex(channel).settings.has_module_settings) { if (channels.getByIndex(channel).settings.has_module_settings) {
precision = channels.getByIndex(channel).settings.module_settings.position_precision; precision = channels.getByIndex(channel).settings.module_settings.position_precision;
} else if (channels.getByIndex(channel).role == meshtastic_Channel_Role_PRIMARY) {
// backwards compatibility for Primary channels created before position_precision was set by default
precision = 13;
} else {
precision = 0;
} }
meshtastic_MeshPacket *p = allocPositionPacket(); meshtastic_MeshPacket *p = allocPositionPacket();