From 4c5afd68e6d73801a8c39b8af1976f8884ac70d7 Mon Sep 17 00:00:00 2001 From: robshape Date: Thu, 20 Apr 2023 20:52:58 +0200 Subject: [PATCH] fix Discard initial battery capacity reading --- src/common/api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/api.c b/src/common/api.c index 87430d6..80051ea 100644 --- a/src/common/api.c +++ b/src/common/api.c @@ -1399,6 +1399,10 @@ static void POW_updateBatteryStatus(void) { // Battery ramp is wrong for bigger batteries. Need to log drain for 2600 mAh, 3500 mAh, and // update range. Reading /capacity seems more accurate for 2600 mAh. int i = getInt("/sys/class/power_supply/battery/capacity"); + if (i == 0) { // Initial reading is incorrect... + pow.charge = 100; + return; + } // worry less about battery and more about the game you're playing if (i>80) pow.charge = 100;