updates to http terminal

This commit is contained in:
2021-06-30 20:33:16 +02:00
parent a0f6a5aec3
commit 66e8ddb2d9
7 changed files with 64 additions and 42 deletions
+13 -7
View File
@@ -27,6 +27,13 @@ Treppe stairs(16);
const char* ssid = STASSID;
const char* password = STAPSK;
// port 80, root directory of server '/'
HTTPServer httpServer(80, "/");
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); }
void timerCallback(void *pArg)
{
@@ -34,16 +41,9 @@ void timerCallback(void *pArg)
stairs.task();
}
// port 80, root directory of server '/'
HTTPServer httpServer(80, "/");
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); }
// ===============================================
void setup() {
#ifdef WITH_DEBUGGING_ON
Serial.begin(460800);
@@ -78,6 +78,8 @@ void setup() {
ota_setup();
httpServer.start();
httpServer.start_apps();
Serial.println("HTTP server started !");
stairs.setup();
@@ -89,6 +91,8 @@ void setup() {
#include <random>
uint32_t c = 0;
void loop() {
// if(stairs.getState() == 0) {
// delay(1000);
@@ -102,6 +106,8 @@ void loop() {
// stairs.setDirection(!stairs.getDirection());
// stairs.setState(1);
// }
if(c++%1000000 == 0)
httpServer.logt("[%d] starting :)\n", c);
TIMEIF_US(ArduinoOTA.handle(), 10000, "OTA");
TIMEIF_US(httpServer.handleClient(), 10000, "HTTP");