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

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

References m_nMinMicros.