mirror of
https://github.com/esphome/esphome.git
synced 2025-09-09 23:02:23 +01:00
fix: add lamp index to active lamps in DynamicLamp management
This commit is contained in:
@@ -115,6 +115,7 @@ void DynamicLamp::add_lamp_(std::string name) {
|
|||||||
this->lamp_count_++;
|
this->lamp_count_++;
|
||||||
this->active_lamps_[this->lamp_count_].active = true;
|
this->active_lamps_[this->lamp_count_].active = true;
|
||||||
this->active_lamps_[this->lamp_count_].name = name;
|
this->active_lamps_[this->lamp_count_].name = name;
|
||||||
|
this->active_lamps_[this->lamp_count_].lamp_index = this->lamp_count_;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ESP_LOGW(TAG, "No more lamps available, max 16 lamps supported!");
|
ESP_LOGW(TAG, "No more lamps available, max 16 lamps supported!");
|
||||||
|
@@ -33,6 +33,7 @@ struct LinkedOutput {
|
|||||||
struct CombinedLamp {
|
struct CombinedLamp {
|
||||||
bool active = false;
|
bool active = false;
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
|
uint8_t lamp_index;
|
||||||
bool used_outputs[16];
|
bool used_outputs[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ class DynamicLamp : public Component {
|
|||||||
void begin();
|
void begin();
|
||||||
void add_lamp_(std::string name);
|
void add_lamp_(std::string name);
|
||||||
std::array<bool, 16> get_lamp_outputs_(uint8_t lamp_number);
|
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 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);
|
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);
|
std::string_view ltrim_(std::string_view str);
|
||||||
|
Reference in New Issue
Block a user