FastLED 3.9.15
Loading...
Searching...
No Matches

◆ countFPS()

void CFastLED::countFPS ( int nFrames = 25)

For debugging, this will keep track of time between calls to countFPS().

Every nFrames calls, it will update an internal counter for the current FPS.

Todo
Make this a rolling counter
Parameters
nFrameshow many frames to time for determining FPS

Definition at line 356 of file FastLED.cpp.

356 {
357 static int br = 0;
358 static fl::u32 lastframe = 0; // millis();
359
360 if(br++ >= nFrames) {
361 fl::u32 now = millis();
362 now -= lastframe;
363 if(now == 0) {
364 now = 1; // prevent division by zero below
365 }
366 m_nFPS = (br * 1000) / now;
367 br = 0;
368 lastframe = millis();
369 }
370}
fl::u16 m_nFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:381

References m_nFPS.