#include "globalvars.h" #include void reload_home() { char time_current[3][3] = {"", "", ""}; if (myTime.hour() < 10) { sprintf(time_current[0], "0%d", myTime.hour()); } else { sprintf(time_current[0], "%d", myTime.hour()); } if (myTime.minute() < 10) { sprintf(time_current[1], "0%d", myTime.minute()); } else { sprintf(time_current[1], "%d", myTime.minute()); } if (myTime.second() < 10) { sprintf(time_current[2], "0%d", myTime.second()); } else { sprintf(time_current[2], "%d", myTime.second()); } sprintf(home_html, "\ \ \ \ \ \ Home\ \ \ \
\

Übersicht

\

Uhrzeit: %s:%s:%s

\
\
\ Ventil 1: \ %s\
\
\ Ventil 2:\ %s\
\
\ Ventil 3:\ %s\
\
\ Ventil 4:\ %s\
\
\ Ventil 5:\ %s\
\
\ Ventil 6:\ %s\
\
\ Ventil 7:\ %s\
\
\ Ventil 8:\ %s\
\ Einstellungen\
\ Kellerheizung\
\
\ \ ", time_current[0], time_current[1], time_current[2], stat[0], stat[1], stat[2], stat[3], stat[4], stat[5], stat[6], stat[7]); } void reload_settings() { sprintf(settings_html, "\ 1\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 2\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 3\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 4\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 5\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 6\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 7\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ 8\ %s:%s\ %s:%s\ %s:%s\ %s:%s\ \ \ \ Übersicht\ \ \ ", time_all[0][0], time_all[1][0], time_all[2][0], time_all[3][0], time_all[4][0], time_all[5][0], time_all[6][0], time_all[7][0], time_all[0][1], time_all[1][1], time_all[2][1], time_all[3][1], time_all[4][1], time_all[5][1], time_all[6][1], time_all[7][1], time_all[0][2], time_all[1][2], time_all[2][2], time_all[3][2], time_all[4][2], time_all[5][2], time_all[6][2], time_all[7][2], time_all[0][3], time_all[1][3], time_all[2][3], time_all[3][3], time_all[4][3], time_all[5][3], time_all[6][3], time_all[7][3], time_all[0][4], time_all[1][4], time_all[2][4], time_all[3][4], time_all[4][4], time_all[5][4], time_all[6][4], time_all[7][4], time_all[0][5], time_all[1][5], time_all[2][5], time_all[3][5], time_all[4][5], time_all[5][5], time_all[6][5], time_all[7][5], time_all[0][6], time_all[1][6], time_all[2][6], time_all[3][6], time_all[4][6], time_all[5][6], time_all[6][6], time_all[7][6], time_all[0][7], time_all[1][7], time_all[2][7], time_all[3][7], time_all[4][7], time_all[5][7], time_all[6][7], time_all[7][7]); } void handleToggle() { int i = server.arg("number") .toInt(); // converts GET argument to int and does stuff xD override[i] = !override[i]; debugln(F("---------------------------")); debug(F("[RECIVED] for: ")); debugln(i); digitalWrite(pins[i], !digitalRead(pins[i])); if (digitalRead(pins[i]) == LOW) { sprintf(stat[i], "AN"); } else { sprintf(stat[i], "AUS"); } debug(F("Status: ")); debugln(stat[i]); reload_home(); server.sendHeader(F("Location"), F("/"), true); server.send(302, F("text/html"), home_html); debugln(override[i]); debugln(F("---------------------------")); }