Battery voltage below minimum should be treated as 0%
This commit is contained in:
@@ -1095,7 +1095,16 @@ void plantcontrol()
|
||||
sensorWater.setProperty("raw").send(String(waterRawSensor.getAverage()));
|
||||
}
|
||||
}
|
||||
sensorLipo.setProperty("percent").send(String(100 * mBatteryVoltage / VOLT_MAX_BATT));
|
||||
|
||||
if (mBatteryVoltage < VOLT_MIN_BATT)
|
||||
{
|
||||
sensorLipo.setProperty("percent").send("0");
|
||||
}
|
||||
else
|
||||
{
|
||||
sensorLipo.setProperty("percent").send(String(100 * (((mBatteryVoltage - VOLT_MIN_BATT) / (VOLT_MAX_BATT - VOLT_MIN_BATT)))));
|
||||
}
|
||||
|
||||
sensorLipo.setProperty("volt").send(String(mBatteryVoltage));
|
||||
sensorLipo.setProperty("current").send(String(battery.getCurrent()));
|
||||
sensorLipo.setProperty("Ah").send(String(battery.getAh()));
|
||||
|
||||
Reference in New Issue
Block a user