mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-02 17:53:46 +00:00
this might work... still need to be tested
This commit is contained in:
parent
5ab322ac1f
commit
2f3320270d
@ -169,6 +169,7 @@ float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming
|
|||||||
return 1.0f;
|
return 1.0f;
|
||||||
#endif
|
#endif
|
||||||
// If we are a router or repeater, always forward because it's assumed these are in the most advantageous locations
|
// If we are a router or repeater, always forward because it's assumed these are in the most advantageous locations
|
||||||
|
// Small meshes don't use coverage filter
|
||||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||||
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
@ -214,7 +215,11 @@ float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming
|
|||||||
coverageRatio = uncoveredWeight / totalWeight;
|
coverageRatio = uncoveredWeight / totalWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
float forwardProb = (coverageRatio * COVERAGE_SCALE_FACTOR);
|
float smallMeshCorrection = 0.0f;
|
||||||
|
if (nodeDB->getNumOnlineMeshNodes(true) <= 10) {
|
||||||
|
smallMeshCorrection = 0.5f;
|
||||||
|
}
|
||||||
|
float forwardProb = (coverageRatio * COVERAGE_SCALE_FACTOR) + smallMeshCorrection;
|
||||||
|
|
||||||
// Clamp probability between BASE_FORWARD_PROB and 1
|
// Clamp probability between BASE_FORWARD_PROB and 1
|
||||||
forwardProb = std::min(std::max(forwardProb, BASE_FORWARD_PROB), 1.0f);
|
forwardProb = std::min(std::max(forwardProb, BASE_FORWARD_PROB), 1.0f);
|
||||||
|
Loading…
Reference in New Issue
Block a user