summaryrefslogtreecommitdiff
path: root/src/components/battery/BatteryController.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2021-10-09 13:39:27 +0300
committerRiku Isokoski <riksu9000@gmail.com>2021-10-09 13:39:27 +0300
commit1777b9dee8f1189df29f627707b970995f0d4afe (patch)
treeb7faa90ee8facf76d45bbb49bce8641489780a98 /src/components/battery/BatteryController.cpp
parenta9f7153fdf92b097b14143b77645f6608ac1bf9c (diff)
Don't measure and notify percentage on charging event.
Diffstat (limited to 'src/components/battery/BatteryController.cpp')
-rw-r--r--src/components/battery/BatteryController.cpp6
1 files changed, 5 insertions, 1 deletions
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<nrf_gpio_pin_pull_t> 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;