mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-11-22 07:57:05 +00:00
suppress single-percent ADC noise for battery level
This commit is contained in:
1 parent
f6d6aff288
commit
29a74c2cd9
1 file changed
+4
-1
@@ -177,7 +177,10 @@ void LvStatusBar::setGPSFix(bool hasFix) {
|
||||
|
||||
void LvStatusBar::setBatteryPercent(int pct) {
|
||||
pct = normalizedBattery(pct);
|
||||
if (_battPct == pct) return;
|
||||
|
||||
// Suppress single-percent ADC noise: only update if the value changed by 2% or more
|
||||
if (_battPct >= 0 && abs(pct - _battPct) < 2) return;
|
||||
|
||||
_battPct = pct;
|
||||
refreshBattery();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user