diff options
| author | The King <27705324+jlukanc1@users.noreply.github.com> | 2021-01-24 16:01:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-24 16:01:14 -0500 |
| commit | 8c3df5f0211e0cc31de90039a73fe48b9a9aafe0 (patch) | |
| tree | 88fc0671a629b27793a418df76f543c7913b644a /src/components/battery/BatteryController.cpp | |
| parent | 51c8cadcb78bdbe9013f5aace629c96ed3dfd06f (diff) | |
| parent | 80838d1e42e83b50188d6237d16c81cfa27781a6 (diff) | |
Merge branch 'develop' into upstream-dev
Diffstat (limited to 'src/components/battery/BatteryController.cpp')
| -rw-r--r-- | src/components/battery/BatteryController.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index 3e3d65b4..aaa245e4 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -34,9 +34,11 @@ void Battery::Update() { // see https://forum.pine64.org/showthread.php?tid=8147 voltage = (value * 2.0f) / (1024/3.0f); - percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; - percentRemaining = std::max(percentRemaining, 0.0f); - percentRemaining = std::min(percentRemaining, 100.0f); + int percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; + percentRemaining = std::max(percentRemaining, 0); + percentRemaining = std::min(percentRemaining, 100); + + percentRemainingBuffer.insert(percentRemaining); // NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); // NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); |
