mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-07-03 12:51:43 +00:00
suppress single-percent ADC noise for battery level
This commit is contained in:
@@ -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