From f06781bc031856cb6dd8ba49c67f68406d2a985a Mon Sep 17 00:00:00 2001 From: david gauchard Date: Wed, 2 Feb 2022 11:19:43 +0100 Subject: [PATCH] minor fixes for emulation on host (https://github.com/d-a-v/emuAsync) --- src/ESPUI.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ESPUI.cpp b/src/ESPUI.cpp index 90ddbb4..dd55063 100644 --- a/src/ESPUI.cpp +++ b/src/ESPUI.cpp @@ -783,9 +783,9 @@ void ESPUIClass::updateControl(Control* control, int clientId) root["id"] = control->id; root["visible"] = control->visible; root["color"] = (int)control->color; - if (control->panelStyle != 0) + if (control->panelStyle.length()) root["panelStyle"] = control->panelStyle; - if (control->elementStyle != 0) + if (control->elementStyle.length()) root["elementStyle"] = control->elementStyle; serializeJson(document, json); @@ -811,7 +811,7 @@ void ESPUIClass::updateControl(Control* control, int clientId) // function like this and it's clients array is private int tryId = 0; - for (size_t count = 0; count < this->ws->count();) + for (size_t count = 0; tryId < (int)this->ws->count() && count < this->ws->count();) { if (this->ws->hasClient(tryId)) { @@ -1003,7 +1003,7 @@ void ESPUIClass::addGraphPoint(uint16_t id, int nValue, int clientId) // function like this and it's clients array is private int tryId = 0; - for (size_t count = 0; count < this->ws->count();) + for (size_t count = 0; tryId < (int)this->ws->count() && count < this->ws->count();) { if (this->ws->hasClient(tryId)) { @@ -1108,9 +1108,9 @@ void ESPUIClass::prepareJSONChunk(AsyncWebSocketClient* client, uint16_t startin item["value"] = String(control->value); item["color"] = (int)control->color; item["visible"] = (int)control->visible; - if (control->panelStyle != 0) + if (control->panelStyle.length()) item["panelStyle"] = String(control->panelStyle); - if (control->elementStyle != 0) + if (control->elementStyle.length()) item["elementStyle"] = String(control->elementStyle); if (control->wide == true) item["wide"] = true;