Battery voltage below minimum should be treated as 0%
This commit is contained in:
parent
dd3888ba52
commit
cbde8ee11c
@ -127,7 +127,7 @@
|
||||
|
||||
#define FIRMWARE_BASENAME "PlantControl"
|
||||
#define FIRMWARE_NAME FIRMWARE_BASENAME FIRMWARE_FEATURE1 FIRMWARE_FEATURE2
|
||||
#define FIRMWARE_VERSIONNMUMBER "3.010"
|
||||
#define FIRMWARE_VERSIONNMUMBER "3.011"
|
||||
|
||||
#ifdef HWREVISION07
|
||||
#define FIRMWARE_VERSION FIRMWARE_VERSIONNMUMBER " HW0.7"
|
||||
@ -158,8 +158,8 @@
|
||||
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
|
||||
#define SOLAR_MAX_VOLTAGE_POSSIBLE 100 /**< higher values are treated as not connected sensor */
|
||||
#define VOLT_MAX_BATT 4.2f
|
||||
#define VOLT_MIN_BATT 3.0f /**< Minimum battery voltage for normal operation */
|
||||
#define LOWVOLT_SLEEP_FACTOR 3 /**< Factor for nightsleep delay, if the battery drops below minimum (@see VOLT_MIN_BATT) */
|
||||
#define VOLT_MIN_BATT 3.2f /**< Minimum battery voltage for normal operation */
|
||||
#define LOWVOLT_SLEEP_FACTOR 6 /**< Factor for nightsleep delay, if the battery drops below minimum (@see VOLT_MIN_BATT) */
|
||||
#define LOWVOLT_SLEEP_MINIMUM 7200 /**< At low voltage sleep at least for 120 minutes (two hours) */
|
||||
|
||||
#define WATER_LEVEL_MINIMUM 500 /**< Minimum Analog value (1023 is the maximum)*/
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user