|
|
@@ -98,11 +98,15 @@ void setup_webserver() { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() { |
|
|
|
Serial.begin(115200); |
|
|
|
Serial.println("Booting"); |
|
|
|
WiFi.mode(WIFI_STA); |
|
|
|
WiFi.begin(ssid, password); |
|
|
|
|
|
|
|
while (WiFi.waitForConnectResult() != WL_CONNECTED) { |
|
|
|
Serial.println("Connection Failed! Rebooting..."); |
|
|
|
delay(5000); |
|
|
@@ -112,10 +116,7 @@ void setup() { |
|
|
|
// setup OTA |
|
|
|
ArduinoOTA.setPort(8266); |
|
|
|
ArduinoOTA.setHostname("ESP_Treppenlicht"); |
|
|
|
|
|
|
|
// No authentication by default |
|
|
|
ArduinoOTA.setPassword("admin"); |
|
|
|
|
|
|
|
// Password can be set with it's md5 value as well |
|
|
|
// MD5(admin) = 21232f297a57a5a743894a0e4a801fc3 |
|
|
|
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3"); |
|
|
@@ -160,10 +161,31 @@ void setup() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
unsigned long i = 0; |
|
|
|
|
|
|
|
unsigned long a = 0; |
|
|
|
unsigned long s = 0; |
|
|
|
float ard_ota_time = 0; |
|
|
|
float server_handle = 0; |
|
|
|
|
|
|
|
void loop() { |
|
|
|
a = micros(); |
|
|
|
ArduinoOTA.handle(); |
|
|
|
ard_ota_time += micros()-a; |
|
|
|
|
|
|
|
s = micros(); |
|
|
|
server.handleClient(); |
|
|
|
server_handle += micros()-s; |
|
|
|
|
|
|
|
if(++i >= 10000) { |
|
|
|
Serial.print("Mittlere Laufzeit\tOTA: "); |
|
|
|
Serial.print(ard_ota_time/10000.0); |
|
|
|
Serial.print("µs\tHTTP: "); |
|
|
|
Serial.print(server_handle/10000.0); |
|
|
|
Serial.println("µs"); |
|
|
|
|
|
|
|
ard_ota_time = 0; |
|
|
|
server_handle = 0; |
|
|
|
i = 0; |
|
|
|
} |
|
|
|
} |