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
-
| nFrames | how many frames to time for determining FPS |
Definition at line 688 of file FastLED.cpp.hpp.
688 {
689 static int br = 0;
690#if SKETCH_HAS_LARGE_MEMORY
691 typedef fl::u32 frame_ms_t;
692#else
693
694 typedef fl::u16 frame_ms_t;
695#endif
696 static frame_ms_t lastframe = 0;
697
698 if(br++ >= nFrames) {
700 frame_ms_t now =
static_cast<frame_ms_t
>(
sample - lastframe);
701 if(now == 0) {
702 now = 1;
703 }
704 mNFPS =
static_cast<fl::u16
>((
static_cast<fl::u32
>(br) * 1000) / now);
705 br = 0;
707 }
708}
fl::u16 mNFPS
tracking for current frames per second (FPS) value
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode) FL_NO_EXCEPT
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
References FL_NO_EXCEPT, fl::millis(), and mNFPS.
Referenced by show(), and showColor().