adding user pref to aid in testing.

This commit is contained in:
medentem 2024-12-31 20:05:51 -06:00
parent ef4850ec8c
commit 584ecd0b4e
3 changed files with 11 additions and 4 deletions

View File

@ -160,6 +160,10 @@ void FloodingRouter::mergeMyCoverage(CoverageFilter &coverage)
float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming, NodeNum from)
{
#ifdef USERPREFS_USE_COVERAGE_FILTER
bool useCoverageFilter = USERPREFS_USE_COVERAGE_FILTER;
if (!useCoverageFilter) return 1.0f;
#endif
// If we are a router or repeater, always forward because it's assumed these are in the most advantageous locations
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
@ -203,7 +207,7 @@ float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming
forwardProb = std::min(std::max(forwardProb, 0.0f), 1.0f);
LOG_DEBUG("CoverageRatio=%.2f, ForwardProb=%.2f (Uncovered=%d, Total=%zu)", coverageRatio, forwardProb, uncovered,
recentNeighbors.size());
neighbors);
return forwardProb;
}

View File

@ -53,10 +53,12 @@ enum RxSource {
#define NUM_HASH_FUNCTIONS 2
// Base forwarding probability - never drop below this value
// 0.2 seems suitable because the worst case False Positive Rate of the
// coverage filter is 37%. That's if its fully saturated with 60 unique nodes.
#define BASE_FORWARD_PROB 0.2f
// Coverage scaling factor
#define COVERAGE_SCALE_FACTOR 0.9f
#define COVERAGE_SCALE_FACTOR 2.0f
// Recency threshold in minutes
// Currently set to 1 hour because that is the minimum interval for nodeinfo broadcasts

View File

@ -30,9 +30,10 @@
// "USERPREFS_LORACONFIG_CHANNEL_NUM": "31",
// "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST",
// "USERPREFS_SPLASH_TITLE": "DEFCONtastic",
"USERPREFS_TZ_STRING": "tzplaceholder "
"USERPREFS_TZ_STRING": "tzplaceholder ",
// "USERPREFS_USE_ADMIN_KEY_0": "{ 0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c }",
// "USERPREFS_USE_ADMIN_KEY_1": "{}",
// "USERPREFS_USE_ADMIN_KEY_2": "{}"
// "USERPREFS_USE_ADMIN_KEY_2": "{}",
// "USERPREFS_NODEINFO_BROADCAST_CHANNEL_HASH": "8"
"USERPREFS_USE_COVERAGE_FILTER": "true"
}