Converted percent remaining calc to int.

This commit is contained in:
panky-codes
2021-01-16 19:51:32 +01:00
parent 11280d5f37
commit e2d1f81915
3 changed files with 7 additions and 8 deletions

View File

@@ -34,9 +34,9 @@ void Battery::Update() {
// see https://forum.pine64.org/showthread.php?tid=8147
voltage = (value * 2.0f) / (1024/3.0f);
float 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);