Keep track of the current frame number.

This commit is contained in:
Fabian Schlenz 2019-10-23 12:36:08 +02:00
parent 029c93166d
commit f5d47fe7da
2 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@
extern uint8_t baseHue; extern uint8_t baseHue;
extern char hostname[30]; extern char hostname[30];
extern uint16_t frame;
typedef struct { typedef struct {
uint8_t width; uint8_t width;

View File

@ -17,6 +17,7 @@ int loop_timeouts = 0;
long loop_started_at = 0; long loop_started_at = 0;
uint8_t baseHue = 0; // defined as extern in prototypes.h uint8_t baseHue = 0; // defined as extern in prototypes.h
char hostname[30]; // defined as extern in prototypes.h char hostname[30]; // defined as extern in prototypes.h
uint16_t frame = 0; // defined as extern in prototypes.h
unsigned long _last_effect_loop_finished_at = 0; unsigned long _last_effect_loop_finished_at = 0;
#ifdef RECORDER_ENABLE #ifdef RECORDER_ENABLE
Recorder* recorder; Recorder* recorder;
@ -84,6 +85,7 @@ void loop() {
} }
EVERY_N_MILLISECONDS(1000 / FPS) { EVERY_N_MILLISECONDS(1000 / FPS) {
frame++;
// Calculate the delay since the last time loop() was called. // Calculate the delay since the last time loop() was called.
// This way, the effect can handle varying frame rates. // This way, the effect can handle varying frame rates.
uint16_t last_loop_ago; uint16_t last_loop_ago;