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

fix: correct lamp count increment logic in add_lamp method

This commit is contained in:
Oliver Kleinecke
2025-02-16 12:36:43 +01:00
parent a6cea002bc
commit 5e46a2a311
2 changed files with 1 additions and 6 deletions

View File

@@ -142,13 +142,13 @@ void DynamicLampComponent::add_available_output(output::FloatOutput * output, st
void DynamicLampComponent::add_lamp(std::string name) {
if (this->lamp_count_ < 15) {
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_;
for (uint8_t i = 0; i < 16; i++) {
this->active_lamps_[this->lamp_count_].used_outputs[i] = false;
}
this->lamp_count_++;
return;
}
ESP_LOGW(TAG, "No more lamps available, max 16 lamps supported!");
@@ -222,10 +222,6 @@ std::array<bool, 16> DynamicLampComponent::get_lamp_outputs_by_name(std::string
return bool_array;
}
void DynamicLampComponent::set_lamp_level(std::string lamp_name, float state) {
}
bool DynamicLampComponent::write_state_(uint8_t lamp_number, float state) {
if (this->active_lamps_[lamp_number].active) {
this->active_lamps_[lamp_number].state_ = state;

View File

@@ -81,7 +81,6 @@ class DynamicLampComponent : public Component {
protected:
friend class DynamicLamp;
void set_lamp_level(std::string lamp_name, float state);
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);
bool write_state_(uint8_t lamp_number, float state);