mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
formatting
This commit is contained in:
parent
ee75345684
commit
d192043853
@ -17,8 +17,9 @@ void BatteryPercentageRingBuffer::update(uint8_t v) {
|
||||
was_charging = false;
|
||||
}
|
||||
|
||||
// Buffer was reintilialized with readout values while charging (can be too high values), reinit with new readout after charging
|
||||
if (was_charging){
|
||||
// Buffer was reintilialized with readout values while charging (can be too high values), reinit with new readout
|
||||
// after charging
|
||||
if (was_charging) {
|
||||
init(v);
|
||||
was_charging = false;
|
||||
}
|
||||
@ -34,7 +35,6 @@ void BatteryPercentageRingBuffer::update(uint8_t v) {
|
||||
}
|
||||
|
||||
uint8_t BatteryPercentageRingBuffer::evaluate() {
|
||||
|
||||
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
|
||||
|
||||
@ -14,7 +14,7 @@ struct BatteryPercentageRingBuffer {
|
||||
uint8_t head = 0;
|
||||
uint16_t sum = 0;
|
||||
uint8_t prev_val = 161;
|
||||
bool was_charging =false;
|
||||
bool was_charging = false;
|
||||
|
||||
void init(uint8_t value);
|
||||
void update(uint8_t value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user