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:
@ -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)
|
||||
|
Reference in New Issue
Block a user