Scaling tweaks (#9653)

* refactor: update throttling factor calculation and add unit tests for scaling behavior

* refactor: adjust throttling factor calculation for improved accuracy in different configurations

* Update src/mesh/Default.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/mesh/Default.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: enhance throttling factor calculation and introduce pow_of_2 utility function

* refactor: improve expected ms calculation in unit tests for Default::getConfiguredOrDefaultMsScaled

* refactor: improve scaling logic for routers and sensors in computeExpectedMs function

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Tom
2026-03-04 05:59:42 -06:00
committed by GitHub
co-authored by GitHub Ben Meadors Copilot
parent 153ab81a9f
commit b7bf251798
4 changed files with 134 additions and 20 deletions
+1 -6
View File
@@ -16,6 +16,7 @@
#include "configuration.h"
#include "detect/LoRaRadioType.h"
#include "main.h"
#include "meshUtils.h" // for pow_of_2
#include "sleep.h"
#include <assert.h>
#include <pb_decode.h>
@@ -31,12 +32,6 @@
#include "STM32WLE5JCInterface.h"
#endif
// Calculate 2^n without calling pow()
uint32_t pow_of_2(uint32_t n)
{
return 1 << n;
}
#define RDEF(name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, frequency_switching, wide_lora) \
{ \
meshtastic_Config_LoRaConfig_RegionCode_##name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, \