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

350 {
351 if(constrain) {
352 // if we're constraining, the new value of m_nMinMicros _must_ be higher than previously (because we're only
353 // allowed to slow things down if constraining)
354 if(refresh > 0) {
355 m_nMinMicros = ((1000000 / refresh) > m_nMinMicros) ? (1000000 / refresh) : m_nMinMicros;
356 }
357 } else if(refresh > 0) {
358 m_nMinMicros = 1000000 / refresh;
359 } else {
360 m_nMinMicros = 0;
361 }
362}
uint32_t m_nMinMicros
minimum µs between frames, used for capping frame rates
Definition FastLED.h:374

References m_nMinMicros.