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 323 of file FastLED.cpp.

323 {
324 static int br = 0;
325 static uint32_t lastframe = 0; // millis();
326
327 if(br++ >= nFrames) {
328 uint32_t now = millis();
329 now -= lastframe;
330 if(now == 0) {
331 now = 1; // prevent division by zero below
332 }
333 m_nFPS = (br * 1000) / now;
334 br = 0;
335 lastframe = millis();
336 }
337}
uint16_t m_nFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:356

References m_nFPS.

Referenced by show(), and showColor().

+ Here is the caller graph for this function: