restart eingefügt
This commit is contained in:
parent
75213be1aa
commit
14d3608e99
@ -19,4 +19,4 @@ lib_deps =
|
|||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
tobiasschuerg/ESP8266 Influxdb@^3.12.1
|
tobiasschuerg/ESP8266 Influxdb@^3.12.1
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
;upload_port = COM3
|
;upload_port = 192.168.2.157
|
||||||
13
src/main.cpp
13
src/main.cpp
@ -102,7 +102,7 @@ void setHtml(){
|
|||||||
} else {
|
} else {
|
||||||
htmltext += "<h2>Server 2 ist offline</h2>";
|
htmltext += "<h2>Server 2 ist offline</h2>";
|
||||||
}
|
}
|
||||||
|
htmltext += "<p><a href=\"/restart\"><button class=\"button\">Restart</button></a></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
String SendHTML(String addtext){
|
String SendHTML(String addtext){
|
||||||
@ -110,7 +110,7 @@ String SendHTML(String addtext){
|
|||||||
ptr += "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
|
ptr += "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
|
||||||
ptr += "<html lang='de'>\n";
|
ptr += "<html lang='de'>\n";
|
||||||
ptr += "<head>\n";
|
ptr += "<head>\n";
|
||||||
ptr += "<title>Gaszaehler Webserver</title>\n";
|
ptr += "<title>ServerWatch Webserver</title>\n";
|
||||||
ptr += "<link rel='stylesheet' type='text/css' href='/f.css'>\n";
|
ptr += "<link rel='stylesheet' type='text/css' href='/f.css'>\n";
|
||||||
ptr += "<meta content='text/html; charset=UTF-8' http-equiv='content-type'>\n";
|
ptr += "<meta content='text/html; charset=UTF-8' http-equiv='content-type'>\n";
|
||||||
ptr += "</head>\n";
|
ptr += "</head>\n";
|
||||||
@ -160,6 +160,9 @@ void printStatus(){
|
|||||||
display.drawString(0,0,"IP: "+WiFi.localIP().toString()+" ;)");
|
display.drawString(0,0,"IP: "+WiFi.localIP().toString()+" ;)");
|
||||||
long rssi = WiFi.RSSI();
|
long rssi = WiFi.RSSI();
|
||||||
char rssiStr[255];
|
char rssiStr[255];
|
||||||
|
if (rssi == 0){
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
sprintf(rssiStr,"RSSID: %d dBm",rssi);
|
sprintf(rssiStr,"RSSID: %d dBm",rssi);
|
||||||
display.drawString(0,11,rssiStr);
|
display.drawString(0,11,rssiStr);
|
||||||
time(&now); // read the current time
|
time(&now); // read the current time
|
||||||
@ -226,6 +229,11 @@ void pw2off(){
|
|||||||
server.send(303);
|
server.send(303);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void restart(){
|
||||||
|
server.sendHeader("Location","/");
|
||||||
|
server.send(200, "text/html", SendHTML("Boot"));
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("Booting");
|
Serial.println("Booting");
|
||||||
@ -256,6 +264,7 @@ void setup() {
|
|||||||
server.on("/auto2/off",auto2off);
|
server.on("/auto2/off",auto2off);
|
||||||
server.on("/pw2/on",pw2on);
|
server.on("/pw2/on",pw2on);
|
||||||
server.on("/pw2/off",pw2off);
|
server.on("/pw2/off",pw2off);
|
||||||
|
server.on("/restart",restart);
|
||||||
|
|
||||||
server.begin();
|
server.begin();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user