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
1 changed files with 10 additions and 4 deletions

View File

@ -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();