1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-09 14:52:20 +01:00

fix: add lamp index to active lamps in DynamicLamp management

This commit is contained in:
Oliver Kleinecke
2025-02-15 12:54:39 +01:00
parent 3e9710c4d6
commit 3b3449b3ec
2 changed files with 3 additions and 1 deletions

View File

@@ -115,6 +115,7 @@ void DynamicLamp::add_lamp_(std::string name) {
this->lamp_count_++;
this->active_lamps_[this->lamp_count_].active = true;
this->active_lamps_[this->lamp_count_].name = name;
this->active_lamps_[this->lamp_count_].lamp_index = this->lamp_count_;
return;
}
ESP_LOGW(TAG, "No more lamps available, max 16 lamps supported!");

View File

@@ -33,6 +33,7 @@ struct LinkedOutput {
struct CombinedLamp {
bool active = false;
std::string name = "";
uint8_t lamp_index;
bool used_outputs[16];
};
@@ -48,7 +49,7 @@ class DynamicLamp : public Component {
void begin();
void add_lamp_(std::string name);
std::array<bool, 16> get_lamp_outputs_(uint8_t lamp_number);
void add_lamp_output_(uint8_t lamp_number, LinkedOutput output);
void add_lamp_output_(std::string lamp_name, LinkedOutput output);
void restore_lamp_values_(uint8_t lamp_number);
void set_lamp_values_(uint8_t lamp_number, bool active, uint16_t selected_outputs, uint8_t mode, uint8_t mode_value);
std::string_view ltrim_(std::string_view str);