prevent overflow with timeouts higher than 71mins.
This commit is contained in:
parent
94848ce00f
commit
1ba2aad7e7
28
src/main.cpp
28
src/main.cpp
@ -14,10 +14,10 @@ static const uint8_t DruckSensorPin = 12;
|
|||||||
static const uint8_t SchuetzPin = 13;
|
static const uint8_t SchuetzPin = 13;
|
||||||
|
|
||||||
/** time config */
|
/** time config */
|
||||||
static const int abschaltzeit = 3600; //sek
|
static const int abschaltzeit = 7200; //sek
|
||||||
static const int maxpumpdauer = 600; //sek
|
static const int maxpumpdauer = 600; //sek
|
||||||
|
|
||||||
Ticker tick;
|
// ticker fuer kein-wasser abschaltung
|
||||||
Ticker status;
|
Ticker status;
|
||||||
|
|
||||||
//pumpendauer maximum ticker
|
//pumpendauer maximum ticker
|
||||||
@ -87,7 +87,6 @@ void WasserSensorCheck() {
|
|||||||
Serial.println("warte 30min");
|
Serial.println("warte 30min");
|
||||||
|
|
||||||
status.detach();
|
status.detach();
|
||||||
tick.detach();
|
|
||||||
|
|
||||||
i = abschaltzeit;
|
i = abschaltzeit;
|
||||||
status.attach(5, []() {
|
status.attach(5, []() {
|
||||||
@ -95,22 +94,21 @@ void WasserSensorCheck() {
|
|||||||
Serial.print("noch ");
|
Serial.print("noch ");
|
||||||
Serial.print(i);
|
Serial.print(i);
|
||||||
Serial.println(" Sekunden verbleibend");
|
Serial.println(" Sekunden verbleibend");
|
||||||
});
|
|
||||||
|
|
||||||
tick.once(abschaltzeit, []() {
|
if (i <= 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.");
|
|
||||||
|
|
||||||
//pruefen ob drucksensor ein
|
//pruefen ob drucksensor ein
|
||||||
DruckschalterInt();
|
DruckschalterInt();
|
||||||
} else {
|
} else {
|
||||||
Serial.print("wassersensor immer noch kein Wasser --> verlaengern um 30min\n\n");
|
Serial.print("wassersensor immer noch kein Wasser --> verlaengern um 120min\n\n");
|
||||||
WasserSensorCheck();
|
WasserSensorCheck();
|
||||||
|
}
|
||||||
|
status.detach();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Wasser Sensor EIN");
|
Serial.println("Wasser Sensor EIN");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user