We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c7b341 commit b9e6d75Copy full SHA for b9e6d75
src/helpers/Battery.cpp
@@ -4,7 +4,8 @@
4
uint16_t batt_percent(uint8_t batt, uint16_t mv) {
5
uint16_t last = mv; // set last to mv so it can never start greater than itself
6
uint16_t p = 0;
7
- for (int i = 0; i < 102; i++) { // always 101 elements, 100 percent and 0
+ // 101 elements including 0 percentile
8
+ for (int i = 0; i < 101; i++) {
9
// if we match the current value or are between the current and last value
10
// we return the lower of the the two, giving accuracy +/- 1% soc
11
if (mv <= last && mv >= batt_curve[i][batt]) {
0 commit comments