Skip to content

Commit

Permalink
Improve Lost and Found
Browse files Browse the repository at this point in the history
As suggested by @RCGV1, this patch sets LOST_AND_FOUND role to
* Broadcast full precision by default
* Save battery by not re-broadcasting

Fixes #5514
  • Loading branch information
fifieldt authored and caveman99 committed Dec 12, 2024
1 parent 7dd3629 commit dd79286
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/mesh/Channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
channelSettings.psk.bytes[0] = defaultpskIndex;
channelSettings.psk.size = 1;
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
channelSettings.module_settings.position_precision = 13; // default to sending location on the primary channel
if (config.device.role == meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND) {
channelSettings.module_settings.position_precision = 32; // lost and found defaults to full precision
} else {
channelSettings.module_settings.position_precision = 13; // default to sending location on the primary channel
}
channelSettings.has_module_settings = true;

ch.has_settings = true;
Expand Down
3 changes: 2 additions & 1 deletion src/mesh/FloodingRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
bool FloodingRouter::isRebroadcaster()
{
return config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE &&
config.device.role != meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND &&
config.device.rebroadcast_mode != meshtastic_Config_DeviceConfig_RebroadcastMode_NONE;
}

Expand All @@ -76,7 +77,7 @@ bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)

return true;
} else {
LOG_DEBUG("No rebroadcast: Role = CLIENT_MUTE or Rebroadcast Mode = NONE");
LOG_DEBUG("No rebroadcast: CLIENT_MUTE/LOST_AND_FOUND or Rebroadcast Mode = NONE");
}
} else {
LOG_DEBUG("Ignore 0 id broadcast");
Expand Down

0 comments on commit dd79286

Please sign in to comment.