Skip to content

Commit 443b6f1

Browse files
authored
Limit total cycles to 60 in battery tracking
Update battery cycle and hour tracking logic to limit cycles to 60.
1 parent 50fc9de commit 443b6f1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/smartbatt/module.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@
6565
let newAvg = weightedAverage(data.avgBattDrainage, data.totalHours, currentDrainage, deltaHours * weightCoefficient);
6666
data.avgBattDrainage = newAvg;
6767
data.timeLastRecorded = now;
68-
data.totalCycles += 1;
69-
data.totalHours += deltaHours;
68+
if(data.totalCycles<60){
69+
data.totalCycles += 1;
70+
data.totalHours += deltaHours;
71+
72+
}
73+
7074
data.battLastRecorded = batt;
7175
storage.writeJSON(dataFile, data);
7276

0 commit comments

Comments
 (0)