Skip to content

Commit 4125038

Browse files
committed
Add device online check to battery polling
1 parent 9bb5056 commit 4125038

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Firmware/RTK_Surveyor/System.ino

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,19 @@ void updateBattery()
342342
//And outputs a serial message to USB
343343
void checkBatteryLevels()
344344
{
345-
battLevel = lipo.getSOC();
346-
battVoltage = lipo.getVoltage();
347-
battChangeRate = lipo.getChangeRate();
345+
if (online.battery == true)
346+
{
347+
battLevel = lipo.getSOC();
348+
battVoltage = lipo.getVoltage();
349+
battChangeRate = lipo.getChangeRate();
350+
}
351+
else
352+
{
353+
//False numbers but above system cut-off level
354+
battLevel = 10;
355+
battVoltage = 3.7;
356+
battChangeRate = 0;
357+
}
348358

349359
Serial.printf("Batt (%d%%): Voltage: %0.02fV", battLevel, battVoltage);
350360

0 commit comments

Comments
 (0)