9 uint8_t result = (table_value + 128) / 257;
10 if (result == 0 && table_value != 0)
20 uint16_t target =
value * 257;
26 return (target - a <=
b - target) ? lo : lo + 1;
32#ifdef USE_LIGHT_POWER_ESTIMATION
38 const uint8_t mid = (lo + hi + 1) / 2;
59 return static_cast<uint8_t
>(std::min(res,
uint32_t(255)));
uint8_t gamma_correct_(uint8_t value) const
Forward gamma: read uint16 PROGMEM table, convert to uint8.
uint8_t power_brightness_
uint8_t color_uncorrect_channel(uint8_t channel, uint8_t raw_value) const
const uint16_t * gamma_table_
uint8_t uncorrect_level_(uint8_t value) const
Reverse gamma and limit for one stored level.
uint8_t limit_(uint8_t res) const ESPHOME_ALWAYS_INLINE
uint8_t gamma_uncorrect_(uint8_t value) const
Reverse gamma: binary search the forward PROGMEM table.
uint8_t local_brightness_
uint8_t gamma_table_reverse_search(const uint16_t *table, uint16_t target)
Binary search a monotonically increasing uint16[256] PROGMEM table.
uint16_t progmem_read_uint16(const uint16_t *addr)