1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-21 22:50:55 +00:00

Send visibility

Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
This commit is contained in:
Lukas Bachschwell 2021-10-29 19:47:46 +02:00
parent aa03c1683d
commit c66f528702
Signed by: lbsadmin
GPG Key ID: CCC6AA87CC8DF425

View File

@ -590,7 +590,7 @@ void onWsEvent(
uint16_t ESPUIClass::addControl(ControlType type, const char* label, const String& value, ControlColor color, uint16_t ESPUIClass::addControl(ControlType type, const char* label, const String& value, ControlColor color,
uint16_t parentControl, void (*callback)(Control*, int)) uint16_t parentControl, void (*callback)(Control*, int))
{ {
Control* control = new Control(type, label, callback, value, color, parentControl); Control* control = new Control(type, label, callback, value, color, true, parentControl);
if (this->controls == nullptr) if (this->controls == nullptr)
{ {
@ -755,6 +755,7 @@ void ESPUIClass::updateControl(Control* control, int clientId)
root["type"] = (int)control->type + ControlType::UpdateOffset; root["type"] = (int)control->type + ControlType::UpdateOffset;
root["value"] = control->value; root["value"] = control->value;
root["id"] = control->id; root["id"] = control->id;
root["visible"] = control->visible;
root["color"] = (int)control->color; root["color"] = (int)control->color;
serializeJson(document, json); serializeJson(document, json);
@ -969,6 +970,7 @@ void ESPUIClass::jsonDom(AsyncWebSocketClient* client)
item["label"] = control->label; item["label"] = control->label;
item["value"] = String(control->value); item["value"] = String(control->value);
item["color"] = (int)control->color; item["color"] = (int)control->color;
item["visible"] = (int)control->visible;
if (control->parentControl != Control::noParent) if (control->parentControl != Control::noParent)
{ {