From fd52ca8fe6f42226ec32a001f4c61dc100ead94a Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Fri, 3 Sep 2021 14:35:38 +0300 Subject: Detect full charge and improve watchface display --- src/components/battery/BatteryController.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/components/battery/BatteryController.h') diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 6f09b737..164057c4 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -23,13 +23,19 @@ namespace Pinetime { } bool IsCharging() const { - return isCharging; + // isCharging will go up and down when fully charged + // isFull makes sure this returns false while fully charged. + return isCharging && !isFull; } bool IsPowerPresent() const { return isPowerPresent; } + bool IsFull() const { + return isFull; + } + private: static Battery* instance; nrf_saadc_value_t saadc_value; @@ -40,6 +46,7 @@ namespace Pinetime { uint16_t voltage = 0; uint8_t percentRemaining = 0; + bool isFull = false; bool isCharging = false; bool isPowerPresent = false; -- cgit v1.2.3-70-g09d2