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 696 of file FastLED.cpp.hpp.
696 {
697 static int br = 0;
698#if SKETCH_HAS_LARGE_MEMORY
699 typedef fl::u32 frame_ms_t;
700#else
701
702 typedef fl::u16 frame_ms_t;
703#endif
704 static frame_ms_t lastframe = 0;
705
706 if(br++ >= nFrames) {
708 frame_ms_t now =
static_cast<frame_ms_t
>(
sample - lastframe);
709 if(now == 0) {
710 now = 1;
711 }
712 mNFPS =
static_cast<fl::u16
>((
static_cast<fl::u32
>(br) * 1000) / now);
713 br = 0;
715 }
716}
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().