Modifikace kvuli multitaskingu v ESP32

This commit is contained in:
Pavel Brychta 2019-01-19 10:05:46 +01:00
parent 542675ef2c
commit d616088f69

View File

@ -24,7 +24,7 @@ struct TraceLine
static TraceLine _lines[MAX_TRACE_LINES]; static TraceLine _lines[MAX_TRACE_LINES];
static uint16_t _lines_index = 0; static uint16_t _lines_index = 0;
static uint16_t _lines_count = 0; static uint16_t _lines_count = 0;
static int _modified = 0; static volatile int _modified = 0;
static AsyncWebSocket *_wss = NULL; // webovy soket pro trasovani static AsyncWebSocket *_wss = NULL; // webovy soket pro trasovani
static Interval _tint; // interval pro casovani stopare static Interval _tint; // interval pro casovani stopare
@ -276,6 +276,7 @@ void trace_poll()
{ // .. a vyprsel timeout pro obcerstvovani { // .. a vyprsel timeout pro obcerstvovani
String log; String log;
_modified = 0; // rusime pozadavek na odeslani novych dat
if (log.reserve((MAX_TRACE_LINES * MAX_LINE_LEN) + (MAX_TRACE_LINES * 50))) if (log.reserve((MAX_TRACE_LINES * MAX_LINE_LEN) + (MAX_TRACE_LINES * 50)))
{ {
log = F("{\"type\":\"trace\",\"data\":["); log = F("{\"type\":\"trace\",\"data\":[");
@ -285,7 +286,6 @@ void trace_poll()
} }
else else
_wss->textAll(F("{\"type\":\"trace\",\"text\":\"Memory error\"}")); _wss->textAll(F("{\"type\":\"trace\",\"text\":\"Memory error\"}"));
_modified = 0; // rusime pozadavek na odeslani novych dat
_tint.set(TRACE_CHECK_INTERVAL); _tint.set(TRACE_CHECK_INTERVAL);
} }
} }