|
|
|
|
|
|
|
|
stairs.task(); |
|
|
stairs.task(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// HTTP |
|
|
|
|
|
void handleNotFound(); |
|
|
|
|
|
|
|
|
// port 80, root directory of server '/' |
|
|
HTTPServer httpServer(80, "/"); |
|
|
HTTPServer httpServer(80, "/"); |
|
|
|
|
|
|
|
|
uint32_t _t=0; |
|
|
uint32_t _t=0; |
|
|
|
|
|
|
|
|
// =============================================== |
|
|
// =============================================== |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void handleNotFound() { |
|
|
|
|
|
String message = "File Not Found\n\n"; |
|
|
|
|
|
message += "URI: "; |
|
|
|
|
|
message += httpServer.uri(); |
|
|
|
|
|
message += "\nMethod: "; |
|
|
|
|
|
message += (httpServer.method() == HTTP_GET) ? "GET" : "POST"; |
|
|
|
|
|
message += "\nArguments: "; |
|
|
|
|
|
message += httpServer.args(); |
|
|
|
|
|
message += "\n"; |
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < httpServer.args(); i++) { |
|
|
|
|
|
message += " " + httpServer.argName(i) + ": " + httpServer.arg(i) + "\n"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
httpServer.send(404, "text/plain", message); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setup() { |
|
|
void setup() { |
|
|
#ifdef WITH_DEBUGGING_ON |
|
|
#ifdef WITH_DEBUGGING_ON |
|
|
|
|
|
|
|
|
ota_setup(); |
|
|
ota_setup(); |
|
|
|
|
|
|
|
|
httpServer.start(); |
|
|
httpServer.start(); |
|
|
httpServer.onNotFound(handleNotFound); |
|
|
|
|
|
Serial.println("HTTP server started !"); |
|
|
Serial.println("HTTP server started !"); |
|
|
|
|
|
|
|
|
stairs.setup(); |
|
|
stairs.setup(); |