Feat: Adds flood.max.unscoped setting

Before this commit, there was no way to set a different max hop count
for unscoped messages.

Now with this change, by defaul it tracks the flood.max setting, until
a user provides a flood.max.unscoped value, which tax precidence for
packets if ROUTE_TYPE_FLOOD is true.
This commit is contained in:
Chris Barker
2026-06-01 21:30:17 +01:00
parent 4573082f90
commit a33f3011a5
4 changed files with 45 additions and 4 deletions
+9 -1
View File
@@ -282,7 +282,14 @@ uint32_t MyMesh::getDirectRetransmitDelay(const mesh::Packet *packet) {
bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
if (_prefs.disable_fwd) return false;
if (packet->isRouteFlood() && packet->getPathHashCount() >= _prefs.flood_max) return false;
if (packet->isRouteFlood()) {
uint8_t limit = _prefs.flood_max;
if (packet->getRouteType() == ROUTE_TYPE_FLOOD
&& _prefs.flood_max_unscoped != FLOOD_MAX_UNSCOPED_UNSET) {
limit = _prefs.flood_max_unscoped;
}
if (packet->getPathHashCount() >= limit) return false;
}
return true;
}
@@ -643,6 +650,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
_prefs.flood_advert_interval = 47; // 47 hours
_prefs.flood_max = 64;
_prefs.flood_max_unscoped = FLOOD_MAX_UNSCOPED_UNSET;
_prefs.interference_threshold = 0; // disabled
#ifdef ROOM_PASSWORD
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));