From 43c3d9d7963abe572b64a37477c1c9451c2c23ed Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 17 Sep 2022 21:54:39 +0200 Subject: [PATCH] bugfix axp192 battpercent --- src/power.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/power.cpp b/src/power.cpp index 70962ef6..72934461 100644 --- a/src/power.cpp +++ b/src/power.cpp @@ -237,7 +237,8 @@ uint8_t read_battlevel(mapFn_t mapFunction) { #ifdef HAS_IP5306 batt_percent = IP5306_GetBatteryLevel(); #elif defined HAS_PMU - batt_percent = pmu.getBatteryPercent(); + int bp = pmu.getBatteryPercent(); + batt_percent = bp < 0 ? 0 : bp; #else const uint16_t batt_voltage = read_voltage(); if (batt_voltage <= BAT_MIN_VOLTAGE)