|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
|
|
|
|
|
#define _WIFIMGR_LOGLEVEL_ 1 |
|
|
|
|
#define DEBUG 1 |
|
|
|
|
#define _WIFIMGR_LOGLEVEL_ 0 |
|
|
|
|
#define DEBUG 0 |
|
|
|
|
|
|
|
|
|
#include <WiFi.h> |
|
|
|
|
#include <WiFiManager.h> |
|
|
|
@ -44,6 +44,7 @@ DHT dht(TEMP_SENS_PIN, DHTTYPE); |
|
|
|
|
const uint8_t degree_sign[8] = { B00010, B00101, B00010, B00000, B00000, B00000, B00000, B00000 }; |
|
|
|
|
uint8_t add_summertime = 0; |
|
|
|
|
bool last_reset_ap_check = false; |
|
|
|
|
bool minmax_enabled = false; |
|
|
|
|
|
|
|
|
|
enum { |
|
|
|
|
ACT, |
|
|
|
@ -68,7 +69,6 @@ void setup() |
|
|
|
|
lcd.setCursor(2, 1); |
|
|
|
|
lcd.print(F("(c)parasiTstudio")); |
|
|
|
|
|
|
|
|
|
DEBUG_MSG("Mode Client\n"); |
|
|
|
|
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
|
|
|
|
|
|
|
|
|
|
WiFiManager wm; |
|
|
|
@ -186,47 +186,67 @@ void loop() |
|
|
|
|
client.println("<!DOCTYPE html>\n"); |
|
|
|
|
client.println("<html>\n"); |
|
|
|
|
client.println("<head>\n"); |
|
|
|
|
client.println("<title>Temperatur KircheGratenstadt Staaken</title>\n"); |
|
|
|
|
client.println("<title>Temperatur Kirche Gartenstadt Staaken</title>\n"); |
|
|
|
|
client.println("<meta http-equiv=\"refresh\" content=\"5\">\n"); |
|
|
|
|
client.println("</head>\n"); |
|
|
|
|
client.println("<body>\n"); |
|
|
|
|
client.println("<center>\n"); |
|
|
|
|
client.println("<h1 style=\"color:green;\">Temperatur Kirche</h1>\n"); |
|
|
|
|
client.println("<h1 style=\"color:green;\">Temperatur</h1>\n"); |
|
|
|
|
client.print("<h2 style=\"color:green;\">Aktuell: "); |
|
|
|
|
client.print(temp[ACT]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:green;\">Minimum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(temp[MIN]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.println(" °C"); |
|
|
|
|
} |
|
|
|
|
client.print("</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:green;\">Maximum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(temp[MAX]); |
|
|
|
|
client.println(" °C"); |
|
|
|
|
} |
|
|
|
|
client.print("</h2>\n"); |
|
|
|
|
client.println("<hr>\n"); |
|
|
|
|
client.println("<h1 style=\"color:red;\">Gefühlte Temperatur</h1>\n"); |
|
|
|
|
client.print("<h2 style=\"color:red;\">Aktuell: "); |
|
|
|
|
client.print(heat[ACT]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:red;\">Minimum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(heat[MIN]); |
|
|
|
|
client.println(" °C"); |
|
|
|
|
} |
|
|
|
|
client.print("</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:red;\">Maximum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(heat[MAX]); |
|
|
|
|
client.println(" °C"); |
|
|
|
|
} |
|
|
|
|
client.print("</h2>\n"); |
|
|
|
|
client.println("<hr>\n"); |
|
|
|
|
client.println("<h1 style=\"color:blue;\">Luftfeuchtigkeit</h1>\n"); |
|
|
|
|
client.print("<h2 style=\"color:blue;\">Aktuell: "); |
|
|
|
|
client.print(hum[ACT]); |
|
|
|
|
client.println(" %</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:blue;\">Minimum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(hum[MIN]); |
|
|
|
|
client.println(" %</h2>\n"); |
|
|
|
|
client.println(" %"); |
|
|
|
|
} |
|
|
|
|
client.println("</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:blue;\">Maximum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
client.print(hum[MAX]); |
|
|
|
|
client.println(" %</h2>\n"); |
|
|
|
|
client.println("<h1 style=\"color:gray;\">Gefühlte Temperatur</h1>\n"); |
|
|
|
|
client.print("<h2 style=\"color:gray;\">Aktuell: "); |
|
|
|
|
client.print(heat[ACT]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:gray;\">Minimum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
client.print(heat[MIN]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.print("<h2 style=\"color:gray;\">Maximum: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
client.print(heat[MAX]); |
|
|
|
|
client.println(" °C</h2>\n"); |
|
|
|
|
client.println(" %"); |
|
|
|
|
} |
|
|
|
|
client.println("</h2>\n"); |
|
|
|
|
|
|
|
|
|
DateTimeParts p = DateTime.getParts(); |
|
|
|
|
char dt[21]; |
|
|
|
@ -236,6 +256,7 @@ void loop() |
|
|
|
|
else |
|
|
|
|
add_summertime = 0; |
|
|
|
|
|
|
|
|
|
client.println("<hr>\n"); |
|
|
|
|
client.print("<h4 style=\"color:black;\">"); |
|
|
|
|
|
|
|
|
|
sprintf(dt, "%02d.%02d.%4d %02d:%02d:%02d", p.getMonthDay(), p.getMonth() + 1, p.getYear(), p.getHours() + add_summertime, p.getMinutes(), p.getSeconds()); |
|
|
|
@ -321,7 +342,7 @@ void show_time(void) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sprintf(dt, "%02d.%02d.%4d %02d:%02d:%02d", p.getMonthDay(), p.getMonth() + 1, p.getYear(), p.getHours() + add_summertime, p.getMinutes(), p.getSeconds()); |
|
|
|
|
DEBUG_MSG("%d", dt); |
|
|
|
|
DEBUG_MSG("%s", dt); |
|
|
|
|
if (add_summertime > 0) |
|
|
|
|
DEBUG_MSG(" Summertime\n"); |
|
|
|
|
else |
|
|
|
@ -346,13 +367,14 @@ void show_temperature(void) |
|
|
|
|
lcd.print(temp[ACT], 1); |
|
|
|
|
lcd.write(0); |
|
|
|
|
lcd.print("C"); |
|
|
|
|
lcd.setCursor(0, 2); |
|
|
|
|
lcd.print("Min: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
{ |
|
|
|
|
lcd.setCursor(0, 2); |
|
|
|
|
lcd.print("Min: "); |
|
|
|
|
lcd.print(temp[MIN], 1); |
|
|
|
|
lcd.print(" Max: "); |
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
lcd.print(" Max: "); |
|
|
|
|
lcd.print(temp[MAX], 1); |
|
|
|
|
} |
|
|
|
|
lcd.setCursor(0, 3); |
|
|
|
|
lcd.print("LF: "); |
|
|
|
|
lcd.print(hum[ACT], 1); |
|
|
|
@ -404,7 +426,10 @@ void get_sensor_data(void) |
|
|
|
|
hum[ACT] = constrain(dht.readHumidity(), 0.0, 100.0); |
|
|
|
|
heat[ACT] = constrain(dht.computeHeatIndex(temp[ACT], hum[ACT], false), -40.0, 80.0); |
|
|
|
|
|
|
|
|
|
if (millis() > FIRST_MIN_MAX) |
|
|
|
|
if (minmax_enabled == false && millis() > FIRST_MIN_MAX) |
|
|
|
|
minmax_enabled = true; |
|
|
|
|
|
|
|
|
|
if (minmax_enabled == true) |
|
|
|
|
{ |
|
|
|
|
if (temp[ACT] < temp[MIN]) |
|
|
|
|
temp[MIN] = temp[ACT]; |
|
|
|
|