1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00

fix: replace static array with dynamic initialization for empty lamp in remove_lamp function of DynamicLampComponent

This commit is contained in:
Oliver Kleinecke 2025-02-19 23:22:19 +01:00
parent c01950a06d
commit 436108d8d7

View File

@ -163,10 +163,11 @@ void DynamicLampComponent::remove_lamp(std::string lamp_name) {
} }
} }
uint16_t memaddress = 0 + (i * 24); uint16_t memaddress = 0 + (i * 24);
this->fram_->write(memaddress, { unsigned char[24] empty_lamp;
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, for (uint8_t m = 0; m < 24; m++) {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff empty_lamp[m] = 0xff;
}, 24); }
this->fram_->write(memaddress, empty_lamp, 24);
this->active_lamps_[i].active = false; this->active_lamps_[i].active = false;
this->lamp_count_--; this->lamp_count_--;
ESP_LOGV(TAG, "Removed lamp %s, total lamps now %" PRIu8 "", this->active_lamps_[i].name, this->lamp_count_); ESP_LOGV(TAG, "Removed lamp %s, total lamps now %" PRIu8 "", this->active_lamps_[i].name, this->lamp_count_);