move turnontime back to on and off context

live view of pressure and watersensor
This commit is contained in:
2020-08-02 11:31:36 +00:00
parent aaf73b2dd7
commit 0261f186bd
3 changed files with 35 additions and 17 deletions

View File

@@ -39,7 +39,8 @@ void pumpeSchalten(bool on) {
if (allow && !error) {
if (on) {
pumpendauer.once(maxpumpdauer + 1, []() { //erlaube keine einschaltung von mehr als 60 sek
pumpendauer.once(maxpumpdauer + 1, []() {
//erlaube keine einschaltung von mehr als 60 sek
if (millis() - turnontime >= maxpumpdauer * 1000 && turnontime != -1) {
//error zu lange
Serial.println("\n\npumpe lief mehr als 10 Minuten durchgaengig");
@@ -47,11 +48,13 @@ void pumpeSchalten(bool on) {
error = true;
}
});
turnontime = millis();
}else{
} else {
mang.setPumpDuration(millis() - turnontime);
}
// save pump start time
turnontime = millis();
digitalWrite(SchuetzPin, on);
Serial.println("[Erfolg] pumpe wird geschalten");
} else {