mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 07:13:25 +00:00
Don't assign negative SNR to unsigned int type
SNR-based contention windows are broken on systems with 64-bit long integers. Fixes #8430
This commit is contained in:
parent
15ee1c2819
commit
39780656ef
@ -272,10 +272,10 @@ uint32_t RadioInterface::getTxDelayMsec()
|
|||||||
uint8_t RadioInterface::getCWsize(float snr)
|
uint8_t RadioInterface::getCWsize(float snr)
|
||||||
{
|
{
|
||||||
// The minimum value for a LoRa SNR
|
// The minimum value for a LoRa SNR
|
||||||
const uint32_t SNR_MIN = -20;
|
const int32_t SNR_MIN = -20;
|
||||||
|
|
||||||
// The maximum value for a LoRa SNR
|
// The maximum value for a LoRa SNR
|
||||||
const uint32_t SNR_MAX = 10;
|
const int32_t SNR_MAX = 10;
|
||||||
|
|
||||||
return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user