Metrics now include the current effect's name.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "functions.h"
|
||||
|
||||
AnimationEffect::AnimationEffect(const char* name, uint32_t bg, int x, int y) {
|
||||
this->name = name;
|
||||
this->xOffset = x;
|
||||
this->yOffset = y;
|
||||
|
||||
@ -23,3 +24,9 @@ void AnimationEffect::loop() {
|
||||
this->animation->drawFrame();
|
||||
this->animation->advance();
|
||||
}
|
||||
|
||||
String AnimationEffect::get_name() {
|
||||
String s = "animation/";
|
||||
s += this->name;
|
||||
return s;
|
||||
}
|
||||
|
@ -47,3 +47,9 @@ void CycleEffect::loop() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String CycleEffect::get_name() {
|
||||
String s = "cycle/";
|
||||
s += effect->get_name();
|
||||
return s;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void loop() {
|
||||
#if defined(MQTT_ENABLE) && defined(MQTT_REPORT_METRICS)
|
||||
EVERY_N_SECONDS(15) {
|
||||
char json[120];
|
||||
snprintf(json, 120, "{\"free_heap\":%u, \"uptime\":%lu, \"fps\":%d, \"time_per_frame\":%lu}", ESP.getFreeHeap(), millis()/1000, FastLED.getFPS(), metrics_frame_time / metrics_frame_count);
|
||||
snprintf(json, 120, "{\"effect\":\"%s\",\"heap\":%u, \"up\":%lu, \"fps\":%d, \"frametime\":%lu}", current_effect->get_name().c_str(), ESP.getFreeHeap(), millis()/1000, FastLED.getFPS(), metrics_frame_time / metrics_frame_count);
|
||||
mqtt_publish("metrics", json);
|
||||
metrics_frame_count = 0;
|
||||
metrics_frame_time = 0;
|
||||
|
Reference in New Issue
Block a user