FastLED 3.9.15
Loading...
Searching...
No Matches

◆ setMaxRefreshRate()

void CFastLED::setMaxRefreshRate ( fl::u16 refresh,
bool constrain = false )

Set the maximum refresh rate.

This is global for all leds. Attempts to call show() faster than this rate will simply wait.

Note
The refresh rate defaults to the slowest refresh rate of all the leds added through addLeds(). If you wish to set/override this rate, be sure to call setMaxRefreshRate() after adding all of your leds.
Parameters
refreshmaximum refresh rate in hz
constrainconstrain refresh rate to the slowest speed yet set

Definition at line 506 of file FastLED.cpp.hpp.

506 {
507 if(constrain) {
508 // if we're constraining, the new value of mNMinMicros _must_ be higher than previously (because we're only
509 // allowed to slow things down if constraining)
510 if(refresh > 0) {
511 mNMinMicros = ((1000000 / refresh) > mNMinMicros) ? (1000000 / refresh) : mNMinMicros;
512 }
513 } else if(refresh > 0) {
514 mNMinMicros = 1000000 / refresh;
515 } else {
516 mNMinMicros = 0;
517 }
518}
fl::u32 mNMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:614

References mNMinMicros.