14 uint8_t maxBrightness,
float lowThreshold,
15 float highThreshold) {
16 float maxBrightnessPercent = (maxBrightness / 255.0f) * 100.0f;
17 if (inputBrightnessPercent < lowThreshold) {
19 }
else if (inputBrightnessPercent < highThreshold) {
20 float range = highThreshold - lowThreshold;
21 float progress = (inputBrightnessPercent - lowThreshold) / range;
23 100.0f - (progress * (100.0f - maxBrightnessPercent));
24 return static_cast<uint8_t
>((targetPercent / 100.0f) * 255.0f);