Added support for reporting for freeHeap via MQTT.
This commit is contained in:
parent
b6d59758d8
commit
5321409727
@ -12,4 +12,6 @@ void mqtt_setup();
|
||||
|
||||
void mqtt_loop();
|
||||
|
||||
void mqtt_publish(const char* topic, int number);
|
||||
|
||||
#endif // mqtt_H
|
||||
|
@ -69,3 +69,11 @@ void mqtt_loop() {
|
||||
mqtt_client.loop();
|
||||
}
|
||||
}
|
||||
|
||||
void mqtt_publish(const char* topic, int number) {
|
||||
char t[127];
|
||||
sprintf(t, MQTT_TOPIC "%s", topic);
|
||||
char b[32];
|
||||
sprintf(b, "%d", number);
|
||||
mqtt_client.publish(t, b);
|
||||
}
|
||||
|
@ -68,6 +68,12 @@ void loop() {
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
EVERY_N_SECONDS(5) {
|
||||
if (REPORT_FREE_HEAP) {
|
||||
mqtt_publish("free_heap", ESP.getFreeHeap());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (MONITOR_LOOP_TIMES && millis()-loop_started_at>=MONITOR_LOOP_TIME_THRESHOLD) {
|
||||
LOG("Core * Loop took "); LOG(millis()-loop_started_at); LOGln("ms.");
|
||||
|
Loading…
Reference in New Issue
Block a user