Disable all outputs (power safing), float number cannot be compared
This commit is contained in:
parent
aa7cb31302
commit
7d6c1c3daa
@ -159,7 +159,7 @@
|
|||||||
#define SOLAR_MAX_VOLTAGE_POSSIBLE 100 /**< higher values are treated as not connected sensor */
|
#define SOLAR_MAX_VOLTAGE_POSSIBLE 100 /**< higher values are treated as not connected sensor */
|
||||||
#define VOLT_MAX_BATT 4.2f
|
#define VOLT_MAX_BATT 4.2f
|
||||||
#define VOLT_SENSORS_BATT 3.6f /**< Minimum battery voltage for sensor (and pump) usage */
|
#define VOLT_SENSORS_BATT 3.6f /**< Minimum battery voltage for sensor (and pump) usage */
|
||||||
#define VOLT_MIN_BATT 3.2f /**< Minimum battery voltage for normal operation */
|
#define VOLT_MIN_BATT 3.4f /**< 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_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 LOWVOLT_SLEEP_MINIMUM 7200 /**< At low voltage sleep at least for 120 minutes (two hours) */
|
||||||
|
|
||||||
|
@ -54,8 +54,10 @@ void Plant::init(void)
|
|||||||
{ return ((candidate >= 0) && (candidate <= 100)); });
|
{ return ((candidate >= 0) && (candidate <= 100)); });
|
||||||
|
|
||||||
/* Initialize Hardware */
|
/* Initialize Hardware */
|
||||||
|
pinMode(this->mPinPump, OUTPUT);
|
||||||
|
digitalWrite(this->mPinPump, LOW);
|
||||||
ledcSetup(this->mPlantId, PWM_FREQ, PWM_BITS);
|
ledcSetup(this->mPlantId, PWM_FREQ, PWM_BITS);
|
||||||
ledcAttachPin(mPinPump, this->mPlantId);
|
ledcAttachPin(this->mPinPump, this->mPlantId);
|
||||||
ledcWrite(this->mPlantId, 0);
|
ledcWrite(this->mPlantId, 0);
|
||||||
pinMode(this->mPinSensor, INPUT);
|
pinMode(this->mPinSensor, INPUT);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ void espDeepSleep(bool afterPump = false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mBatteryVoltage < VOLT_MIN_BATT)
|
if ( ((int) (mBatteryVoltage * 100)) < ((int) (VOLT_MIN_BATT * 100)) )
|
||||||
{
|
{
|
||||||
/* use the largest sleeping duration */
|
/* use the largest sleeping duration */
|
||||||
if (deepSleepNightTime.get() > deepSleepTime.get()) {
|
if (deepSleepNightTime.get() > deepSleepTime.get()) {
|
||||||
@ -772,6 +772,7 @@ void safeSetup()
|
|||||||
digitalWrite(OUTPUT_ENABLE_PUMP, LOW);
|
digitalWrite(OUTPUT_ENABLE_PUMP, LOW);
|
||||||
|
|
||||||
pinMode(OUTPUT_ENABLE_SENSOR, OUTPUT);
|
pinMode(OUTPUT_ENABLE_SENSOR, OUTPUT);
|
||||||
|
digitalWrite(OUTPUT_ENABLE_SENSOR, LOW);
|
||||||
|
|
||||||
#ifdef ANALOG_WATER
|
#ifdef ANALOG_WATER
|
||||||
pinMode(SENSOR_TANK_ANALOG, INPUT);
|
pinMode(SENSOR_TANK_ANALOG, INPUT);
|
||||||
@ -843,9 +844,11 @@ void safeSetup()
|
|||||||
sensorCount = sensors.getDS18Count();
|
sensorCount = sensors.getDS18Count();
|
||||||
delay(50);
|
delay(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readOneWireSensors();
|
||||||
mBatteryVoltage = battery.getVoltage(BATTSENSOR_INDEX_BATTERY);
|
mBatteryVoltage = battery.getVoltage(BATTSENSOR_INDEX_BATTERY);
|
||||||
|
|
||||||
if (mBatteryVoltage >= VOLT_SENSORS_BATT)
|
if ( ((int) (mBatteryVoltage * 100)) >= ((int) (VOLT_SENSORS_BATT * 100)) )
|
||||||
{
|
{
|
||||||
/* read all sensors with additional power source */
|
/* read all sensors with additional power source */
|
||||||
readPowerSwitchedSensors();
|
readPowerSwitchedSensors();
|
||||||
@ -1102,7 +1105,7 @@ void plantcontrol()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBatteryVoltage < VOLT_MIN_BATT)
|
if ( ((int) (mBatteryVoltage * 100)) < ((int) (VOLT_MIN_BATT * 100)) )
|
||||||
{
|
{
|
||||||
sensorLipo.setProperty("percent").send("0");
|
sensorLipo.setProperty("percent").send("0");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user