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

372 {
373 if(constrain) {
374 // if we're constraining, the new value of m_nMinMicros _must_ be higher than previously (because we're only
375 // allowed to slow things down if constraining)
376 if(refresh > 0) {
377 m_nMinMicros = ((1000000 / refresh) > m_nMinMicros) ? (1000000 / refresh) : m_nMinMicros;
378 }
379 } else if(refresh > 0) {
380 m_nMinMicros = 1000000 / refresh;
381 } else {
382 m_nMinMicros = 0;
383 }
384}
fl::u32 m_nMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:382

References m_nMinMicros.