15#ifdef USE_POWER_SUPPLY
30#ifdef USE_LIGHT_POWER_ESTIMATION
36#ifdef USE_LIGHT_POWER_ESTIMATION
52 virtual int32_t
size()
const = 0;
69 if (amnt > this->
size())
78 if (amnt > this->
size())
86 void set_correction(
float red,
float green,
float blue,
float white = 1.0f) {
88 Color(to_uint8_scale(red), to_uint8_scale(green), to_uint8_scale(blue), to_uint8_scale(white)));
90#ifdef USE_LIGHT_POWER_ESTIMATION
92 void set_power_estimation(
float ma_red,
float ma_green,
float ma_blue,
float ma_white,
float idle_ma_per_led) {
97 power->ma_per_level[1] = ma_green / 255.0f;
98 power->ma_per_level[2] = ma_blue / 255.0f;
99 power->ma_per_level[3] = ma_white / 255.0f;
100 power->idle_ma_per_led = idle_ma_per_led;
108#ifdef USE_LIGHT_GAMMA_LUT
116#ifdef USE_POWER_SUPPLY
126#ifdef USE_POWER_SUPPLY
127 for (
const auto &c : *
this) {
128 if (c.get_red_raw() > 0 || c.get_green_raw() > 0 || c.get_blue_raw() > 0 || c.get_white_raw() > 0) {
139 if (now_us - last_us >= interval_us)
145#ifdef USE_LIGHT_POWER_ESTIMATION
152 float frame_ma_(
float *slack_ma =
nullptr)
const;
158#ifdef USE_LIGHT_POWER_ESTIMATION
161#ifdef USE_POWER_SUPPLY
171 void start()
override;
172 optional<LightColorValues>
apply()
override;
float draw_ma_(const uint32_t sums[4]) const
virtual void clear_effect_data()=0
void shift_left(int32_t amnt)
virtual ESPColorView get_view_internal(int32_t index) const =0
void set_power_estimation(float ma_red, float ma_green, float ma_blue, float ma_white, float idle_ma_per_led)
void set_power_supply(power_supply::PowerSupply *power_supply)
void setup_state(LightState *state) override
bool throttle_show_(uint32_t now_us, uint32_t last_us, uint32_t interval_us)
LightState * state_parent_
ESPColorView get(int32_t index)
float frame_ma_(float *slack_ma=nullptr) const
power_supply::PowerSupplyRequester power_
void shift_right(int32_t amnt)
void setup_power_budget_()
float get_estimated_current_ma() const
ESPColorView operator[](int32_t index) const
void set_max_current_ma(float max_current_ma)
void set_effect_active(bool effect_active)
virtual int32_t size() const =0
void call_setup() override
PowerEstimation * power_estimation_
bool is_effect_active() const
void update_state(LightState *state) override
void set_correction(float red, float green, float blue, float white=1.0f)
ESPRangeView range(int32_t from, int32_t to)
std::unique_ptr< LightTransformer > create_default_transition() override
ESPColorCorrection correction_
Use a custom state class for addressable lights, to allow type system to discriminate between address...
float get_estimated_current_ma() const
void set_max_brightness(const Color &max_brightness)
void set_gamma_table(const uint16_t *table)
A half-open range of LEDs, inclusive of the begin index and exclusive of the end index,...
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
LightState(LightOutput *output)
void schedule_write_()
Schedule a write to the light output and enable the loop to process it.
const uint16_t * get_gamma_table() const
Get the forward gamma lookup table, 256 PROGMEM entries.
void set_parent(PowerSupply *parent)
Color color_from_light_color_values(LightColorValues val)
Convert the color information from a LightColorValues object to a Color object (does not apply bright...
int32_t HOT interpret_index(int32_t index, int32_t size)