|
|
|
|
@@ -1,6 +1,8 @@
|
|
|
|
|
String logfile = "";
|
|
|
|
|
|
|
|
|
|
void setup_webserver(){
|
|
|
|
|
httpUpdater.setup(&server, "Licht", "Wecker");
|
|
|
|
|
|
|
|
|
|
server.on("/log", []() { //Define the handling function for the path
|
|
|
|
|
|
|
|
|
|
server.send(200, "text/plain", logfile);
|
|
|
|
|
@@ -16,8 +18,8 @@ void handle_webserver(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String Header = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>Lichtwecker</title></head><body><div id=\"header\"><h1>Licht Wecker</h1></div><div id=\"content\" style=\"font-size:1.2em;\">";
|
|
|
|
|
String Footer = "</div><br><br><br><div id=\"footer\">Hardware: " + Hardware + ", Software:"+ Software +"</div></body></html> ";
|
|
|
|
|
String Header = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title>Lichtwecker</title></head><body style=\"text-align:left;margin:0.5em\"><div id=\"header\"><h1 style=\"margin:0px;padding:0px\">Licht Wecker</h1><hr></div><div id=\"content\" style=\"font-size:1.2em;\">";
|
|
|
|
|
String Footer = "</div><br><br><hr><div id=\"footer\">Not for Sale, Prototyp by <a href=\"http://christian.mittring-mering.de/\">CHM</a>, Hardware: " + Hardware + ", Software: "+ Software +"</div></body></html> ";
|
|
|
|
|
|
|
|
|
|
void handleRootPath() { //Handler for the rooth path
|
|
|
|
|
handleArgs();
|
|
|
|
|
@@ -74,6 +76,7 @@ void handleArgs(){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if(server.argName(i) == "reset" && server.arg(i) == "true"){
|
|
|
|
|
print_reset();
|
|
|
|
|
ESP.restart();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -85,16 +88,21 @@ void handleArgs(){
|
|
|
|
|
void print_website(){
|
|
|
|
|
bool A1 = Clock.checkAlarmEnabled(1);
|
|
|
|
|
bool A2 = Clock.checkAlarmEnabled(2);
|
|
|
|
|
String Alarm1 = "Alarm 1: <form action=\"/\" methode=\"get\"><input type=\"text\" name=\"al1h\" value=\"" + String(al1h) + "\">:<input type=\"text\" name=\"al1m\" value=\"" + String(al1m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + " Aktiv: " + getBoolString(A1) + "<br><a href=\"?a1=true\">Aktivieren</a> " + " <a href=\"?a1=false\">Deaktivieren</a>";
|
|
|
|
|
String Alarm2 = "Alarm 2: <form action=\"/\" methode=\"get\"><input type=\"text\" name=\"al2h\" value=\"" + String(al2h) + "\">:<input type=\"text\" name=\"al2m\" value=\"" + String(al2m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + " Aktiv: " + getBoolString(A2) + "<br><a href=\"?a2=true\">Aktivieren</a> " + " <a href=\"?a2=false\">Deaktivieren</a>";
|
|
|
|
|
String Alarm1 = "Alarm 1: <form action=\"/\" methode=\"get\"><input type=\"text\" name=\"al1h\" value=\"" + String(al1h) + "\">:<input type=\"text\" name=\"al1m\" value=\"" + String(al1m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + "<br>Aktiv: " + getBoolString(A1) + "<br><a href=\"?a1=true\">Aktivieren</a> " + " <a href=\"?a1=false\">Deaktivieren</a>";
|
|
|
|
|
String Alarm2 = "Alarm 2: <form action=\"/\" methode=\"get\"><input type=\"text\" name=\"al2h\" value=\"" + String(al2h) + "\">:<input type=\"text\" name=\"al2m\" value=\"" + String(al2m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + "<br>Aktiv: " + getBoolString(A2) + "<br><a href=\"?a2=true\">Aktivieren</a> " + " <a href=\"?a2=false\">Deaktivieren</a>";
|
|
|
|
|
String Alarm = "<h3>Alarm</h3>" + Alarm1 + "<br><br>" + Alarm2;
|
|
|
|
|
String Zeit = "<br><h3>Zeit</h3>" + String(h) + ":" + String(m) + ":" + String(s) + " - " + String(d) + "." + String(M) + "." + String(y) + " | DST: " + String(summertime_EU(y,M,d,h,1));
|
|
|
|
|
String NTP = "<br><h3>NTP</h3>" + String("stündliches Zeit Update über Netzwerk: ") + getBoolString(ntp_update) + "<br><a href=\"?ntp=true\">Aktivieren</a> " + " <a href=\"?ntp=false\">Deaktivieren</a>";
|
|
|
|
|
String Reboot = "<br><h3>System:</h3><a href=\"?reset=true\">Neustart</a>";
|
|
|
|
|
String NTP = "<br><h3>NTP</h3>" + String("stündliches Zeit Update über " + ntp_server + ": ") + getBoolString(ntp_update) + "<br><a href=\"?ntp=true\">Aktivieren</a> " + " <a href=\"?ntp=false\">Deaktivieren</a>";
|
|
|
|
|
String Reboot = "<br><h3>System:</h3><a href=\"?reset=true\">Neustart</a><br><br><a href=\"update\">Software Update Modus</a>";
|
|
|
|
|
String Body = Alarm + Zeit + NTP + Reboot;
|
|
|
|
|
server.send(200, "text/html", Header + Body + Footer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print_reset(){
|
|
|
|
|
String Body = "Neustart... <a href=\"/\">Neu laden</a>";
|
|
|
|
|
server.send(200, "text/html", Header + Body + Footer);
|
|
|
|
|
delay(500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Helpers
|
|
|
|
|
//####################################################################################
|
|
|
|
|
|