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