Skip to content

Commit

Permalink
Fix battery averaging
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed Aug 8, 2022
1 parent aa39634 commit e4e2acb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ static void update() {
battery_sum += battery_new;
battery_sum -= battery_buffer.push_back(battery_new);
battery_avg =
battery_sum / static_cast<float>(std::min(BATTERY_BUFFER_SIZE, cnt));
battery_sum / static_cast<float>(std::min(BATTERY_BUFFER_SIZE,
cnt / BATTERY_PROBE_PERIOD));
}

if (battery_avg < params.battery_min_voltage) {
Expand Down

0 comments on commit e4e2acb

Please sign in to comment.