diff --git a/src/main.cpp b/src/main.cpp index bc76232..ed7b025 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,9 +9,9 @@ extern "C" { #include "user_interface.h" } // OTA & WEB -#include "wifi_credentials.h" -#include "ota.h" #include "httpserver.h" +#include "ota.h" +#include "wifi_credentials.h" // BOARD #define ESP12_LED 2 @@ -32,12 +32,12 @@ HTTPServer httpServer(80, "/", &stairs); uint32_t _t=0; #define SP_US(_str,_a) Serial.print(_str); Serial.print(" took: "); Serial.print(_a); Serial.println("us") -#define TIMEIF_US(_f, _l, _str) _t=micros(); _f; _t=micros()-_t; if(_t > _l) { SP_US(_str, _t); } +#define TIMEIF_US(_f, _l, _str) _t=micros(); _f; _t=micros()-_t; if(_t > (_l)) { SP_US(_str, _t); } void timerCallback(void *pArg) { - *((int *) pArg) += 1; + *(static_cast(pArg)) += 1; stairs.task(); } @@ -92,12 +92,15 @@ void setup() { uint32_t c = 0; void loop() { - if(inter){ + if(inter != 0u){ Serial.printf("interrupt\n"); inter = 0; } - if(c++%1000000 == 0) + if(c++%1000000 == 0) { { { httpServer.logt("[%d] starting :)\n", c); +} +} +} TIMEIF_US(ArduinoOTA.handle(), 10000, "OTA"); TIMEIF_US(httpServer.handleClient(), 10000, "HTTP");