lr2021 debug v2

This commit is contained in:
liquidraver committed 2026-08-14 08:36:36 +02:00
1 parent ae0ff65cce
commit ff0db0dcb8
4 files changed
+138 -10

No files matched your search

+7 -1
View File
@@ -1091,7 +1091,13 @@ int8_t LoRaRadioBase::cadLevelMinEff()
uint8_t base = hwCadBasePeak();
uint8_t pmin = hwCadPeakMin();
if (base == 0 || pmin == 0 || pmin <= base - CAD_LEVEL_MIN) {
/* The clamp only binds when the lowest peak the static window can reach,
* base + CAD_LEVEL_MIN, would land below it. Note the sign: this was
* written `base - CAD_LEVEL_MIN` once, which with CAD_LEVEL_MIN negative
* evaluates to base + 8 — always above pmin, so the narrowing never
* happened and the whole function was inert. */
if (base == 0 || pmin == 0 ||
(int)base + CAD_LEVEL_MIN >= (int)pmin) {
return CAD_LEVEL_MIN;
}
return (int8_t)((int)pmin - (int)base);