mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-16 07:42:37 +00:00
Allow hop_limit to be configured
https://github.com/meshtastic/Meshtastic-device/issues/1007
This commit is contained in:
@@ -16,8 +16,13 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
|
||||
// If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our
|
||||
// message will rebroadcast. But asking for hop_limit 0 in that context means the client app has no preference on hop counts
|
||||
// and we want this message to get through the whole mesh, so use the default.
|
||||
if (p->to == NODENUM_BROADCAST && p->hop_limit == 0)
|
||||
p->hop_limit = HOP_RELIABLE;
|
||||
if (p->to == NODENUM_BROADCAST && p->hop_limit == 0) {
|
||||
if (radioConfig.preferences.hop_limit && radioConfig.preferences.hop_limit <= HOP_MAX) {
|
||||
p->hop_limit = (radioConfig.preferences.hop_limit >= HOP_MAX) ? HOP_MAX : radioConfig.preferences.hop_limit;
|
||||
} else {
|
||||
p->hop_limit = HOP_RELIABLE;
|
||||
}
|
||||
}
|
||||
|
||||
auto copy = packetPool.allocCopy(*p);
|
||||
startRetransmission(copy);
|
||||
|
||||
Reference in New Issue
Block a user