From 584ecd0b4ee52950b1ea5089ac4b60cff88d997f Mon Sep 17 00:00:00 2001 From: medentem Date: Tue, 31 Dec 2024 20:05:51 -0600 Subject: [PATCH] adding user pref to aid in testing. --- src/mesh/FloodingRouter.cpp | 6 +++++- src/mesh/MeshTypes.h | 4 +++- userPrefs.jsonc | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index 741197ce6..b82bb4796 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -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; } \ No newline at end of file diff --git a/src/mesh/MeshTypes.h b/src/mesh/MeshTypes.h index 15b027bc6..8693a6e70 100644 --- a/src/mesh/MeshTypes.h +++ b/src/mesh/MeshTypes.h @@ -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 diff --git a/userPrefs.jsonc b/userPrefs.jsonc index b790577c3..6da3edf77 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -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" } \ No newline at end of file