feat: implemented clearGraph function

This commit is contained in:
leokeba 2022-11-03 03:31:04 +01:00
parent 48594de29a
commit f35d3a19d4
1 changed files with 20 additions and 1 deletions

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)
{