mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-08 08:37:38 +03:00
formatting
This commit is contained in:
parent
ee75345684
commit
d192043853
@ -17,7 +17,8 @@ void BatteryPercentageRingBuffer::update(uint8_t v) {
|
|||||||
was_charging = false;
|
was_charging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buffer was reintilialized with readout values while charging (can be too high values), reinit with new readout after charging
|
// Buffer was reintilialized with readout values while charging (can be too high values), reinit with new readout
|
||||||
|
// after charging
|
||||||
if (was_charging) {
|
if (was_charging) {
|
||||||
init(v);
|
init(v);
|
||||||
was_charging = false;
|
was_charging = false;
|
||||||
@ -34,7 +35,6 @@ void BatteryPercentageRingBuffer::update(uint8_t v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BatteryPercentageRingBuffer::evaluate() {
|
uint8_t BatteryPercentageRingBuffer::evaluate() {
|
||||||
|
|
||||||
uint8_t new_val = (sum + MAX_SAMPLES / 2) / MAX_SAMPLES;
|
uint8_t new_val = (sum + MAX_SAMPLES / 2) / MAX_SAMPLES;
|
||||||
|
|
||||||
// Battery percentage should not increase when not charging so we just cap it to be lower than the last value
|
// Battery percentage should not increase when not charging so we just cap it to be lower than the last value
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user