FastLED
3.10.6
Loading...
Searching...
No Matches
auto_brightness.h
Go to the documentation of this file.
1
// auto_brightness.h - Content-aware brightness compression for LED strips
2
//
3
// NOTE: a twin of this file lives in examples/MoodRing/auto_brightness.h.
4
// Examples cannot include across directories, so the file is duplicated.
5
// Fix both, or neither.
6
#pragma once
7
8
#include "FastLED.h"
9
#include "
fl/stl/span.h
"
10
11
// Average brightness of an LED strip as a percentage (0-100).
12
float
getAverageBrightness
(
fl::span<const CRGB>
leds
);
13
14
// Map content brightness to an output brightness byte using a three-segment
15
// compression curve:
16
// below lowThreshold -> full brightness (255)
17
// lowThreshold..high -> linear ramp down to maxBrightness
18
// above highThreshold -> maxBrightness
19
uint8_t
applyBrightnessCompression
(
float
inputBrightnessPercent,
20
uint8_t
maxBrightness,
float
lowThreshold,
21
float
highThreshold);
leds
CRGB leds[1]
Definition
AnalogOutput.ino:26
applyBrightnessCompression
uint8_t applyBrightnessCompression(float inputBrightnessPercent, uint8_t maxBrightness, float lowThreshold, float highThreshold)
Definition
auto_brightness.cpp:20
getAverageBrightness
float getAverageBrightness(fl::span< const CRGB > leds)
Definition
auto_brightness.cpp:8
fl::span
Definition
span.h:410
span.h
uint8_t
unsigned char uint8_t
Definition
stdint.h:208
examples
AnimartrixRing
auto_brightness.h
Generated on Sun Oct 4 2026 23:08:59 for FastLED by
1.13.2