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:
@@ -142,13 +142,13 @@ void DynamicLampComponent::add_available_output(output::FloatOutput * output, st
|
|||||||
|
|
||||||
void DynamicLampComponent::add_lamp(std::string name) {
|
void DynamicLampComponent::add_lamp(std::string name) {
|
||||||
if (this->lamp_count_ < 15) {
|
if (this->lamp_count_ < 15) {
|
||||||
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_;
|
this->active_lamps_[this->lamp_count_].lamp_index = this->lamp_count_;
|
||||||
for (uint8_t i = 0; i < 16; i++) {
|
for (uint8_t i = 0; i < 16; i++) {
|
||||||
this->active_lamps_[this->lamp_count_].used_outputs[i] = false;
|
this->active_lamps_[this->lamp_count_].used_outputs[i] = false;
|
||||||
}
|
}
|
||||||
|
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!");
|
||||||
@@ -222,10 +222,6 @@ std::array<bool, 16> DynamicLampComponent::get_lamp_outputs_by_name(std::string
|
|||||||
return bool_array;
|
return bool_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicLampComponent::set_lamp_level(std::string lamp_name, float state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicLampComponent::write_state_(uint8_t lamp_number, float state) {
|
bool DynamicLampComponent::write_state_(uint8_t lamp_number, float state) {
|
||||||
if (this->active_lamps_[lamp_number].active) {
|
if (this->active_lamps_[lamp_number].active) {
|
||||||
this->active_lamps_[lamp_number].state_ = state;
|
this->active_lamps_[lamp_number].state_ = state;
|
||||||
|
@@ -81,7 +81,6 @@ class DynamicLampComponent : public Component {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class DynamicLamp;
|
friend class DynamicLamp;
|
||||||
void set_lamp_level(std::string lamp_name, float state);
|
|
||||||
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);
|
||||||
bool write_state_(uint8_t lamp_number, float state);
|
bool write_state_(uint8_t lamp_number, float state);
|
||||||
|
Reference in New Issue
Block a user