15#ifdef USE_POWER_SUPPLY
30#ifdef USE_LIGHT_POWER_ESTIMATION
36#ifdef USE_LIGHT_POWER_ESTIMATION
52 virtual int32_t
size()
const = 0;
67 if (amnt > this->
size())
76 if (amnt > this->
size())
84 void set_correction(
float red,
float green,
float blue,
float white = 1.0f) {
86 Color(to_uint8_scale(red), to_uint8_scale(green), to_uint8_scale(blue), to_uint8_scale(white)));
88#ifdef USE_LIGHT_POWER_ESTIMATION
91 float idle_ma_per_led) {
105#ifdef USE_LIGHT_GAMMA_LUT
113#ifdef USE_POWER_SUPPLY
125#ifdef USE_POWER_SUPPLY
126 for (
const auto &view : *
this) {
127 if (view.get_raw().is_on()) {
137 if (now_us - last_us >= interval_us)
143#ifdef USE_LIGHT_POWER_ESTIMATION
150 float frame_ma_(
float *slack_ma =
nullptr)
const;
157#ifdef USE_LIGHT_POWER_ESTIMATION
160#ifdef USE_POWER_SUPPLY
170 void start()
override;
171 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)
void set_power_supply(power_supply::PowerSupply *power_supply)
void setup_state(LightState *state) override
ESPColorAccessor * accessor_
bool throttle_show_(uint32_t now_us, uint32_t last_us, uint32_t interval_us)
LightState * state_parent_
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)
int32_t interpret_index_(int32_t index) const
void set_effect_active(bool effect_active)
virtual int32_t size() const =0
void call_setup() override
void set_power_estimation(PowerEstimation *storage, float ma_red, float ma_green, float ma_blue, float ma_white, float idle_ma_per_led)
PowerEstimation * power_estimation_
ESPColorView get(int32_t index) const
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
Abstract interface for accessing color and effect data for an addressable light by index.
void set_max_brightness(const Color &max_brightness)
void set_gamma_table(const uint16_t *table)
Gets or sets the color or effect data at a specific index within an color accessor.
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.
static NullColorAccessor instance
Singleton instance of this accessor.
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...