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

◆ setMaxRefreshRate()

void CFastLED::setMaxRefreshRate ( uint16_t 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 339 of file FastLED.cpp.

339 {
340 if(constrain) {
341 // if we're constraining, the new value of m_nMinMicros _must_ be higher than previously (because we're only
342 // allowed to slow things down if constraining)
343 if(refresh > 0) {
344 m_nMinMicros = ((1000000 / refresh) > m_nMinMicros) ? (1000000 / refresh) : m_nMinMicros;
345 }
346 } else if(refresh > 0) {
347 m_nMinMicros = 1000000 / refresh;
348 } else {
349 m_nMinMicros = 0;
350 }
351}
uint32_t m_nMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:357

References m_nMinMicros.