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

◆ applyBrightnessCompression()

uint8_t applyBrightnessCompression ( float inputBrightnessPercent,
uint8_t maxBrightness,
float lowThreshold,
float highThreshold )

Definition at line 13 of file auto_brightness.cpp.

15 {
16 float maxBrightnessPercent = (maxBrightness / 255.0f) * 100.0f;
17 if (inputBrightnessPercent < lowThreshold) {
18 return 255;
19 } else if (inputBrightnessPercent < highThreshold) {
20 float range = highThreshold - lowThreshold;
21 float progress = (inputBrightnessPercent - lowThreshold) / range;
22 float targetPercent =
23 100.0f - (progress * (100.0f - maxBrightnessPercent));
24 return static_cast<uint8_t>((targetPercent / 100.0f) * 255.0f);
25 } else {
26 return maxBrightness;
27 }
28}
unsigned char uint8_t
Definition s16x16x4.h:209

Referenced by loop().

+ Here is the caller graph for this function: