Browse Source

Update uptime, heap in web UI every heartbeat

fastled
Xose Pérez 6 years ago
parent
commit
40fe2e44bc
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      code/espurna/utils.ino

+ 12
- 0
code/espurna/utils.ino View File

@ -120,6 +120,18 @@ void heartbeat() {
mqttSend(MQTT_TOPIC_STATUS, MQTT_STATUS_ONLINE, true);
#endif
// Send info to websocket clients
{
char buffer[200];
snprintf_P(
buffer,
sizeof(buffer) - 1,
PSTR("{\"time\": \"%s\", \"uptime\": %lu, \"heap\": %lu}"),
ntpDateTime().c_str(), uptime_seconds, free_heap
);
wsSend(buffer);
}
}
// -----------------------------------------------------------------------------


Loading…
Cancel
Save