From a6b573bc5cbb135079fe8b6f53d550c480693026 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 24 Feb 2025 22:48:37 +0100 Subject: [PATCH] Added clamping to the battery capacity to work around buggy OS drivers --- es-core/src/SystemStatus.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/es-core/src/SystemStatus.cpp b/es-core/src/SystemStatus.cpp index 6f772b464..775e26cbe 100644 --- a/es-core/src/SystemStatus.cpp +++ b/es-core/src/SystemStatus.cpp @@ -452,6 +452,11 @@ void SystemStatus::getStatusBattery() } #endif + if (batteryCapacity < 0) + batteryCapacity = 0; + if (batteryCapacity > 100) + batteryCapacity = 100; + mHasBattery = hasBattery; mBatteryCharging = batteryCharging; mBatteryCapacity = batteryCapacity;