Better frametime calculation in pitrix.cpp

This commit is contained in:
Fabian Schlenz 2019-10-18 17:03:48 +02:00
parent efe9b924ec
commit 1418d519d5

View File

@ -100,8 +100,17 @@ void loop() {
last_loop_ago = 0; last_loop_ago = 0;
} }
#ifdef MQTT_REPORT_METRICS
unsigned long effect_loop_started = millis();
#endif
current_effect->loop(last_loop_ago); 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. // Save the time for the next run.
_last_effect_loop_finished_at = now; _last_effect_loop_finished_at = now;
@ -109,10 +118,7 @@ void loop() {
effect_clock.loop_with_invert(current_effect->clock_as_mask()); effect_clock.loop_with_invert(current_effect->clock_as_mask());
} }
FastLED.show(); FastLED.show();
#ifdef MQTT_REPORT_METRICS
metrics_frame_count++;
metrics_frame_time += (millis() - loop_started_at);
#endif
#ifdef RECORDER_ENABLE #ifdef RECORDER_ENABLE
recorder->loop(); recorder->loop();