From f136306335e66859d7184b798266f43f4b684036 Mon Sep 17 00:00:00 2001 From: sven Date: Tue, 29 Aug 2023 10:03:58 +0200 Subject: [PATCH] =?UTF-8?q?Debugfile=20gel=C3=B6scht,=20Remanente=20Datenh?= =?UTF-8?q?altung=20f=C3=BCr=20Sp=20nachgebaut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TankCool.ino | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---- serial.txt | 0 2 files changed, 62 insertions(+), 4 deletions(-) delete mode 100644 serial.txt diff --git a/TankCool.ino b/TankCool.ino index 0f80c1a..e427d92 100644 --- a/TankCool.ino +++ b/TankCool.ino @@ -4,6 +4,8 @@ #include #include #include +#include + /********************************************************************/ // Data wire is plugged into pin 2 on the Arduino @@ -26,6 +28,11 @@ float TT1_Sp = 30.0; float TT2_Sp = 30.0; float TKW_Sp = 0.0; float Hyst_Sp = 0.5; +// Hilfswerte für EEPROM schreiben +float H_TT1_Sp; +float H_TT2_Sp; +float H_TKW_Sp; +float H_Hyst_Sp; float TT1_AV; float TT2_AV; @@ -74,13 +81,24 @@ void setup(void) Serial.print("Server gestartet. IP: "); // IP des Arduino-Servers ausgeben Serial.println(Ethernet.localIP()); + + // Get Setpoints from EEPROM + + EEPROM.get(0, TT1_Sp); + EEPROM.get(4, TT2_Sp); + EEPROM.get(8, TKW_Sp); + EEPROM.get(12, Hyst_Sp); + H_TT1_Sp = TT1_Sp; + H_TT2_Sp = TT2_Sp; + H_TKW_Sp = TKW_Sp; + H_Hyst_Sp = Hyst_Sp; } void loop(void) { // Versorge Zeit unsigned long currentMillis = millis(); - + // Hole Temperaturen sensors.requestTemperatures(); TT1_AV = sensors.getTempC(adT1); @@ -191,6 +209,12 @@ void webserver() { // dann ist die Anfrage zu Ende und wir können antworten if (c == '\n' && currentLineIsBlank) { Serial.println(readString); + + + Serial.println(TT1_Sp); + Serial.println(TT2_Sp); + Serial.println(TKW_Sp); + Serial.println(Hyst_Sp); // Wertänderung T 1 b_str = readString.indexOf("T1_Sp="); e_str = readString.indexOf(" HTTP/"); @@ -205,7 +229,7 @@ void webserver() { } } } - // Wertänderung T 1 + // Wertänderung T 2 b_str = readString.indexOf("T2_Sp="); e_str = readString.indexOf(" HTTP/"); t2_str = ""; @@ -219,7 +243,28 @@ void webserver() { } } } - + + // Wertänderung EEPROM schreiben + b_str = readString.indexOf("EEPROM="); + if (b_str != -1){ + EEPROM.get(0, H_TT1_Sp); + EEPROM.get(4, H_TT2_Sp); + EEPROM.get(8, H_TKW_Sp); + EEPROM.get(12, H_Hyst_Sp); + if (H_TT1_Sp != TT1_Sp){ + EEPROM.put(0, TT1_Sp); + } + if (H_TT2_Sp != TT2_Sp){ + EEPROM.put(4, TT2_Sp); + } + if (H_TKW_Sp != TKW_Sp){ + EEPROM.put(8, TT1_Sp); + } + if (H_Hyst_Sp != Hyst_Sp){ + EEPROM.put(12, Hyst_Sp); + } + } + // HTTP Header 200 an den Browser schicken client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); @@ -281,6 +326,7 @@ client.print(" "); client.print(" "); client.print(" "); client.print(" "); +client.print(" "); client.print(" Bypass"); if (State_Bypass== 0){ client.print(" "); @@ -290,8 +336,20 @@ client.print(" "); } client.print(" "); client.print(" "); - client.print(" "); +client.print(" "); +client.print(" EEPROM"); +client.print(" T1 "); client.print(H_TT1_Sp); client.print("°C"); +client.print(" T2 "); client.print(H_TT2_Sp); client.print("°C"); +client.print(" KW "); client.print(H_TKW_Sp); client.print("°C"); +client.print(" Hyst "); client.print(H_Hyst_Sp); client.print("°C"); +client.print(" "); +client.print("
"); +client.print(" "); +client.print("
"); +client.print(" "); +client.print(" "); + client.print(""); client.println(""); break; diff --git a/serial.txt b/serial.txt deleted file mode 100644 index e69de29..0000000