From 1777b9dee8f1189df29f627707b970995f0d4afe Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 9 Oct 2021 13:39:27 +0300 Subject: Don't measure and notify percentage on charging event. --- src/components/battery/BatteryController.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/components/battery/BatteryController.cpp') diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index 0ef4ff1a..e807f033 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -13,7 +13,7 @@ Battery::Battery() { nrf_gpio_cfg_input(PinMap::Charging, static_cast GPIO_PIN_CNF_PULL_Disabled); } -void Battery::Update() { +void Battery::ReadPowerState() { isCharging = !nrf_gpio_pin_read(PinMap::Charging); isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent); @@ -22,6 +22,10 @@ void Battery::Update() { } else if (!isPowerPresent) { isFull = false; } +} + +void Battery::MeasureVoltage() { + ReadPowerState(); if (isReading) { return; -- cgit v1.2.3