diff --git a/src/pitrix.cpp b/src/pitrix.cpp index 6a74bfa..050c301 100644 --- a/src/pitrix.cpp +++ b/src/pitrix.cpp @@ -100,8 +100,17 @@ void loop() { last_loop_ago = 0; } + #ifdef MQTT_REPORT_METRICS + unsigned long effect_loop_started = millis(); + #endif + current_effect->loop(last_loop_ago); + #ifdef MQTT_REPORT_METRICS + metrics_frame_count++; + metrics_frame_time += (millis() - effect_loop_started); + #endif + // Save the time for the next run. _last_effect_loop_finished_at = now; @@ -109,10 +118,7 @@ void loop() { effect_clock.loop_with_invert(current_effect->clock_as_mask()); } FastLED.show(); - #ifdef MQTT_REPORT_METRICS - metrics_frame_count++; - metrics_frame_time += (millis() - loop_started_at); - #endif + #ifdef RECORDER_ENABLE recorder->loop();