Set config.lora.hop_limit to HOP_RELIABLE

This commit is contained in:
Sacha Weatherstone 2022-08-27 19:03:26 +10:00
parent fd27a40edb
commit 1b25ea714d
No known key found for this signature in database
GPG Key ID: 7AB2D7E206124B31
3 changed files with 3 additions and 10 deletions

View File

@ -162,6 +162,7 @@ void NodeDB::installDefaultConfig()
config.lora.region = Config_LoRaConfig_RegionCode_Unset;
config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LongFast;
config.lora.hop_limit = HOP_RELIABLE;
resetRadioConfig();
strncpy(config.device.ntp_server, "0.pool.ntp.org", 32);
// FIXME: Default to bluetooth capability of platform as default

View File

@ -17,11 +17,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
// 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->hop_limit == 0) {
if (config.lora.hop_limit && config.lora.hop_limit <= HOP_MAX) {
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
} else {
p->hop_limit = HOP_RELIABLE;
}
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
}
auto copy = packetPool.allocCopy(*p);

View File

@ -118,11 +118,7 @@ MeshPacket *Router::allocForSending()
p->which_payloadVariant = MeshPacket_decoded_tag; // Assume payload is decoded at start.
p->from = nodeDB.getNodeNum();
p->to = NODENUM_BROADCAST;
if (config.lora.hop_limit && config.lora.hop_limit <= HOP_MAX) {
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
} else {
p->hop_limit = HOP_RELIABLE;
}
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
p->id = generatePacketId();
p->rx_time =
getValidTime(RTCQualityFromNet); // Just in case we process the packet locally - make sure it has a valid timestamp