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

340 {
341 static int br = 0;
342 static uint32_t lastframe = 0; // millis();
343
344 if(br++ >= nFrames) {
345 uint32_t now = millis();
346 now -= lastframe;
347 if(now == 0) {
348 now = 1; // prevent division by zero below
349 }
350 m_nFPS = (br * 1000) / now;
351 br = 0;
352 lastframe = millis();
353 }
354}
uint16_t m_nFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:373

References m_nFPS.

Referenced by show(), and showColor().

+ Here is the caller graph for this function: