1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-12-25 04:00:49 +00:00

feat: implemented clearGraph function

This commit is contained in:
leokeba 2022-11-03 03:31:04 +01:00
parent 48594de29a
commit f35d3a19d4

View File

@ -1031,7 +1031,26 @@ void ESPUIClass::updateTime(uint16_t id, int clientId)
updateControl(id, clientId);
}
void ESPUIClass::clearGraph(uint16_t id, int clientId) { }
void ESPUIClass::clearGraph(uint16_t id, int clientId) {
do // once
{
Control* control = getControl(id);
if (!control)
{
break;
}
DynamicJsonDocument document(jsonUpdateDocumentSize);
JsonObject root = document.to<JsonObject>();
root[F("type")] = 109;
root[F("value")] = 0;
root[F("id")] = control->id;
SendJsonDocToWebSocket(document, clientId);
} while(false);
}
void ESPUIClass::addGraphPoint(uint16_t id, int nValue, int clientId)
{