1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 06:10:18 +00:00

Add Time control

Adds a new invisible control that can fetch the current time from a
connected client. Documentation is in the README.
This commit is contained in:
Ian Gray
2022-01-20 21:50:06 +00:00
parent b33be0057f
commit 9cd15db1ad
6 changed files with 62 additions and 7 deletions

View File

@ -576,6 +576,12 @@ void onWsEvent(
ESPUI.updateControl(c, client->id());
c->callback(c, S_VALUE);
}
else if (msg.startsWith(F("time:")))
{
c->value = msg.substring(msg.indexOf(':') + 1, msg.lastIndexOf(':'));
ESPUI.updateControl(c, client->id());
c->callback(c, TM_VALUE);
}
else
{
#if defined(DEBUG_ESPUI)
@ -940,6 +946,11 @@ void ESPUIClass::updateGauge(uint16_t id, int number, int clientId)
updateControlValue(id, String(number), clientId);
}
void ESPUIClass::updateTime(uint16_t id, int clientId)
{
updateControl(id, clientId);
}
void ESPUIClass::clearGraph(uint16_t id, int clientId) { }
void ESPUIClass::addGraphPoint(uint16_t id, int nValue, int clientId)