sending debug over ws events (wip)

This commit is contained in:
2021-07-01 23:46:32 +03:00
parent a0b01f4839
commit 3fad0f86f6
8 changed files with 90 additions and 9 deletions

View File

@ -1,3 +1,27 @@
#include <Arduino.h>
#include <queue>
void serial_setup();
void serial_loop();
class WsSerial{
std::queue<String> debug;
public:
void print(const String& );
void println(const String& );
inline void println(const float num){ println(String(num)) ; };
inline const String& pop(){ const String& first = debug.front(); debug.pop(); return first;};
inline bool empty(){ return debug.empty();};
};
#if(false)
#define DEBUG_OUT Serial
#define DEBUG_SERIAL true
#else
#define DEBUG_SERIAL false
static WsSerial debug_out;
#define DEBUG_OUT debug_out
#endif

View File

@ -1,8 +1,10 @@
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncEventSource.h>
#include <LittleFS.h>
static AsyncWebServer server(80);
static AsyncEventSource events("/events");
void server_setup();
void server_loop();