From 3381d68baadbf1327c0008154cdde986e93f3d17 Mon Sep 17 00:00:00 2001 From: minacode Date: Wed, 12 Oct 2022 20:29:33 +0200 Subject: [PATCH 1/2] add dummy function --- sim/components/battery/BatteryController.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sim/components/battery/BatteryController.h b/sim/components/battery/BatteryController.h index d84af45..d07243d 100644 --- a/sim/components/battery/BatteryController.h +++ b/sim/components/battery/BatteryController.h @@ -21,6 +21,10 @@ namespace Pinetime { return voltage; } + bool BatteryIsLow() const { + return false; + } + bool IsCharging() const { // isCharging will go up and down when fully charged // isFull makes sure this returns false while fully charged. From 81c060874f4740833afb633783b95acf5c1040a3 Mon Sep 17 00:00:00 2001 From: minacode Date: Wed, 12 Oct 2022 21:17:22 +0200 Subject: [PATCH 2/2] added threshold --- sim/components/battery/BatteryController.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sim/components/battery/BatteryController.h b/sim/components/battery/BatteryController.h index d07243d..61d10f3 100644 --- a/sim/components/battery/BatteryController.h +++ b/sim/components/battery/BatteryController.h @@ -22,7 +22,7 @@ namespace Pinetime { } bool BatteryIsLow() const { - return false; + return percentRemaining <= lowBatteryThreshold; } bool IsCharging() const { @@ -53,6 +53,8 @@ namespace Pinetime { //void SaadcEventHandler(nrfx_saadc_evt_t const* p_event); //static void AdcCallbackStatic(nrfx_saadc_evt_t const* event); + static constexpr uint8_t lowBatteryThreshold {20}; + bool isReading = false; Pinetime::System::SystemTask* systemTask = nullptr;