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