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

334 {
335 static int br = 0;
336 static uint32_t lastframe = 0; // millis();
337
338 if(br++ >= nFrames) {
339 uint32_t now = millis();
340 now -= lastframe;
341 if(now == 0) {
342 now = 1; // prevent division by zero below
343 }
344 m_nFPS = (br * 1000) / now;
345 br = 0;
346 lastframe = millis();
347 }
348}
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: