We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 414fedc commit 0b69e75Copy full SHA for 0b69e75
examples/UPS/UPS.ino
@@ -106,9 +106,9 @@ void loop() {
106
bool bDischarging = !bCharging; // TODO - replace with sensor
107
int iBattSoc = analogRead(BATTSOCPIN); // potensiometer value in [0,1024)
108
109
- iRemaining = (byte)(round((float)100*iBattSoc/1024));
110
- iRunTimeToEmpty = (uint16_t)round((float)iAvgTimeToEmpty*iRemaining/100);
111
-
+ iRemaining = (byte)(round((float)iFullChargeCapacity*iBattSoc/1024));
+ iRunTimeToEmpty = (uint16_t)round((float)iAvgTimeToEmpty*iRemaining/iFullChargeCapacity);
+
112
// Charging
113
iPresentStatus.Charging = bCharging;
114
iPresentStatus.ACPresent = bACPresent;
0 commit comments