detach before call

This commit is contained in:
lukas 2021-04-01 17:33:57 +02:00
parent 9c782879a5
commit 6adfb3c09e

View File

@ -108,6 +108,8 @@ void WasserSensorCheck() {
status.detach(); status.detach();
wateroutagewaitduration = settingsservice.getSettings()->waterOutageWaitDuration; wateroutagewaitduration = settingsservice.getSettings()->waterOutageWaitDuration;
status.detach();
status.attach(5, []() { status.attach(5, []() {
wateroutagewaitduration -= 5; wateroutagewaitduration -= 5;
Serial.print("noch "); Serial.print("noch ");
@ -115,6 +117,7 @@ void WasserSensorCheck() {
Serial.println(" Sekunden verbleibend"); Serial.println(" Sekunden verbleibend");
if (wateroutagewaitduration <= 0) { if (wateroutagewaitduration <= 0) {
status.detach();
if (digitalRead(WasserSensorPin)) { if (digitalRead(WasserSensorPin)) {
allow = true; allow = true;
Serial.println("Einschalten der Pumpe wieder erlaubt."); Serial.println("Einschalten der Pumpe wieder erlaubt.");
@ -125,7 +128,6 @@ void WasserSensorCheck() {
Serial.print("wassersensor immer noch kein Wasser --> verlaengern um 120min\n\n"); Serial.print("wassersensor immer noch kein Wasser --> verlaengern um 120min\n\n");
WasserSensorCheck(); WasserSensorCheck();
} }
status.detach();
} }
}); });
} else { } else {