Debugfile gelöscht, Remanente Datenhaltung für Sp nachgebaut
This commit is contained in:
parent
f4391a7b4a
commit
f136306335
66
TankCool.ino
66
TankCool.ino
|
@ -4,6 +4,8 @@
|
||||||
#include <Controllino.h>
|
#include <Controllino.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
// Data wire is plugged into pin 2 on the Arduino
|
// 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 TT2_Sp = 30.0;
|
||||||
float TKW_Sp = 0.0;
|
float TKW_Sp = 0.0;
|
||||||
float Hyst_Sp = 0.5;
|
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 TT1_AV;
|
||||||
float TT2_AV;
|
float TT2_AV;
|
||||||
|
@ -74,13 +81,24 @@ void setup(void)
|
||||||
Serial.print("Server gestartet. IP: ");
|
Serial.print("Server gestartet. IP: ");
|
||||||
// IP des Arduino-Servers ausgeben
|
// IP des Arduino-Servers ausgeben
|
||||||
Serial.println(Ethernet.localIP());
|
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)
|
void loop(void)
|
||||||
{
|
{
|
||||||
// Versorge Zeit
|
// Versorge Zeit
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
|
|
||||||
// Hole Temperaturen
|
// Hole Temperaturen
|
||||||
sensors.requestTemperatures();
|
sensors.requestTemperatures();
|
||||||
TT1_AV = sensors.getTempC(adT1);
|
TT1_AV = sensors.getTempC(adT1);
|
||||||
|
@ -191,6 +209,12 @@ void webserver() {
|
||||||
// dann ist die Anfrage zu Ende und wir können antworten
|
// dann ist die Anfrage zu Ende und wir können antworten
|
||||||
if (c == '\n' && currentLineIsBlank) {
|
if (c == '\n' && currentLineIsBlank) {
|
||||||
Serial.println(readString);
|
Serial.println(readString);
|
||||||
|
|
||||||
|
|
||||||
|
Serial.println(TT1_Sp);
|
||||||
|
Serial.println(TT2_Sp);
|
||||||
|
Serial.println(TKW_Sp);
|
||||||
|
Serial.println(Hyst_Sp);
|
||||||
// Wertänderung T 1
|
// Wertänderung T 1
|
||||||
b_str = readString.indexOf("T1_Sp=");
|
b_str = readString.indexOf("T1_Sp=");
|
||||||
e_str = readString.indexOf(" HTTP/");
|
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=");
|
b_str = readString.indexOf("T2_Sp=");
|
||||||
e_str = readString.indexOf(" HTTP/");
|
e_str = readString.indexOf(" HTTP/");
|
||||||
t2_str = "";
|
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
|
// HTTP Header 200 an den Browser schicken
|
||||||
client.println("HTTP/1.1 200 OK");
|
client.println("HTTP/1.1 200 OK");
|
||||||
client.println("Content-Type: text/html");
|
client.println("Content-Type: text/html");
|
||||||
|
@ -281,6 +326,7 @@ client.print(" <input type=\"submit\" value=\"Submit\">");
|
||||||
client.print(" </form>");
|
client.print(" </form>");
|
||||||
client.print(" </td>");
|
client.print(" </td>");
|
||||||
client.print(" </tr>");
|
client.print(" </tr>");
|
||||||
|
client.print(" <tr>");
|
||||||
client.print(" <td>Bypass</td>");
|
client.print(" <td>Bypass</td>");
|
||||||
if (State_Bypass== 0){
|
if (State_Bypass== 0){
|
||||||
client.print(" <td bgcolor=#00FF00></td>");
|
client.print(" <td bgcolor=#00FF00></td>");
|
||||||
|
@ -290,8 +336,20 @@ client.print(" <td></td>");
|
||||||
}
|
}
|
||||||
client.print(" <td></td>");
|
client.print(" <td></td>");
|
||||||
client.print(" <td></td>");
|
client.print(" <td></td>");
|
||||||
|
|
||||||
client.print(" </tr>");
|
client.print(" </tr>");
|
||||||
|
client.print(" <tr>");
|
||||||
|
client.print(" <td>EEPROM</td>");
|
||||||
|
client.print(" <td> T1 "); client.print(H_TT1_Sp); client.print("°C</td>");
|
||||||
|
client.print(" <td> T2 "); client.print(H_TT2_Sp); client.print("°C</td>");
|
||||||
|
client.print(" <td> KW "); client.print(H_TKW_Sp); client.print("°C</td>");
|
||||||
|
client.print(" <td> Hyst "); client.print(H_Hyst_Sp); client.print("°C</td>");
|
||||||
|
client.print(" <td>");
|
||||||
|
client.print(" <form action=\"/\" method=\"get\">");
|
||||||
|
client.print(" <input id=\"EEPROM\" name=\"EEPROM\" type=\"submit\" value=\"Submit\">");
|
||||||
|
client.print(" </form>");
|
||||||
|
client.print(" </td>");
|
||||||
|
client.print(" </tr>");
|
||||||
|
|
||||||
client.print("</table>");
|
client.print("</table>");
|
||||||
client.println("</body></html>");
|
client.println("</body></html>");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue