Disable pumps while OTA running, mode2 is called only once
This commit is contained in:
parent
58e3e3c652
commit
8657eedc43
@ -11,7 +11,7 @@
|
||||
#ifndef CONTROLLER_CONFIG_H
|
||||
#define CONTROLLER_CONFIG_H
|
||||
|
||||
#define FIRMWARE_VERSION "1.0.5"
|
||||
#define FIRMWARE_VERSION "1.0.6"
|
||||
|
||||
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
|
||||
#define ADC_TO_VOLT_WITH_MULTI(adc, multi) (((adc) * 3.3 * (multi)) / 4095)
|
||||
|
@ -371,18 +371,17 @@ void readSensors() {
|
||||
void onHomieEvent(const HomieEvent& event) {
|
||||
switch(event.type) {
|
||||
case HomieEventType::SENDING_STATISTICS:
|
||||
mode2MQTT();
|
||||
Homie.getLogger() << "My statistics" << endl;
|
||||
break;
|
||||
case HomieEventType::MQTT_READY:
|
||||
//wait for rtc sync?
|
||||
rtcDeepSleepTime = deepSleepTime.get();
|
||||
Serial << rtcDeepSleepTime << " ms ds" << endl;
|
||||
mode2MQTT();
|
||||
Homie.getLogger() << "MQTT 1" << endl;
|
||||
Serial << "MQTT ready " << rtcDeepSleepTime << " ms ds" << endl;
|
||||
for(int i=0; i < MAX_PLANTS; i++) {
|
||||
mPlants[i].postMQTTconnection();
|
||||
}
|
||||
|
||||
mode2MQTT();
|
||||
break;
|
||||
case HomieEventType::READY_TO_SLEEP:
|
||||
Homie.getLogger() << "rtsleep" << endl;
|
||||
@ -391,11 +390,17 @@ void onHomieEvent(const HomieEvent& event) {
|
||||
case HomieEventType::OTA_STARTED:
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
gpio_hold_dis(GPIO_NUM_13); //pump pwr
|
||||
gpio_deep_sleep_hold_dis();
|
||||
for (int i=0; i < MAX_PLANTS; i++) {
|
||||
mPlants[i].deactivatePump();
|
||||
}
|
||||
mode3Active=true;
|
||||
break;
|
||||
case HomieEventType::OTA_SUCCESSFUL:
|
||||
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
ESP.restart();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user