mirror of
https://github.com/esphome/esphome.git
synced 2025-09-09 23:02:23 +01:00
fix: update LinkedOutput structure to track availability and usage state
This commit is contained in:
@@ -97,7 +97,7 @@ void DynamicLamp::set_save_mode(uint8_t save_mode) {
|
|||||||
|
|
||||||
void DynamicLamp::add_available_output(output::FloatOutput * output, std::string output_id) {
|
void DynamicLamp::add_available_output(output::FloatOutput * output, std::string output_id) {
|
||||||
uint8_t counter = 0;
|
uint8_t counter = 0;
|
||||||
while (this->available_outputs_[counter].active) {
|
while (this->available_outputs_[counter].available) {
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
this->available_outputs_[counter] = LinkedOutput{
|
this->available_outputs_[counter] = LinkedOutput{
|
||||||
@@ -126,9 +126,9 @@ void DynamicLamp::add_lamp_(std::string name) {
|
|||||||
void DynamicLamp::add_lamp_output_(std::string lamp_name, LinkedOutput output) {
|
void DynamicLamp::add_lamp_output_(std::string lamp_name, LinkedOutput output) {
|
||||||
while (i < 16) {
|
while (i < 16) {
|
||||||
if (this->active_lamps_[i].name == lamp_name) {
|
if (this->active_lamps_[i].name == lamp_name) {
|
||||||
this->add_lamp_output_(i, output);
|
|
||||||
this->active_lamps_[lamp_number].used_outputs[output.output_index] = true;
|
this->active_lamps_[lamp_number].used_outputs[output.output_index] = true;
|
||||||
ESP_LOGV(TAG, "Added output %s to lamp %" PRIu8 "", output.output_id.c_str(), lamp_number);
|
output.in_use = true;
|
||||||
|
ESP_LOGV(TAG, "Added output %s to lamp %s", output.output_id.c_str(), lamp_name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@@ -19,7 +19,8 @@ enum LinkedOutputModeIdx : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct LinkedOutput {
|
struct LinkedOutput {
|
||||||
bool active = false;
|
bool available = false;
|
||||||
|
bool in_use = false;
|
||||||
std::string output_id;
|
std::string output_id;
|
||||||
uint8_t output_index;
|
uint8_t output_index;
|
||||||
output::FloatOutput *output;
|
output::FloatOutput *output;
|
||||||
|
Reference in New Issue
Block a user