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

490 {
491 static int br = 0;
492 static fl::u32 lastframe = 0; // fl::millis();
493
494 if(br++ >= nFrames) {
495 fl::u32 now = fl::millis();
496 now -= lastframe;
497 if(now == 0) {
498 now = 1; // prevent division by zero below
499 }
500 mNFPS = (br * 1000) / now;
501 br = 0;
502 lastframe = fl::millis();
503 }
504}
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:613
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.

References fl::millis(), and mNFPS.

Referenced by show(), and showColor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: