1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-22 13:12:22 +01:00

fix: add validation check for timers in read_timers_to_log method of DynamicLampComponent

This commit is contained in:
Oliver Kleinecke
2025-02-19 20:05:26 +01:00
parent 5abdff81c1
commit 944d9661bf

View File

@@ -326,6 +326,7 @@ void DynamicLampComponent::read_timers_to_log() {
DynamicLampTimer timer; DynamicLampTimer timer;
for (uint8_t i = 0; i < 12; i++) { for (uint8_t i = 0; i < 12; i++) {
this->fram_->read((0x4000 + (i * 64)), reinterpret_cast<unsigned char *>(&timer), 64); this->fram_->read((0x4000 + (i * 64)), reinterpret_cast<unsigned char *>(&timer), 64);
if (timer.validation_bytes[0] == 'V' && timer.validation_bytes[1] == 'D' && timer.validation_bytes[2] == 'L' && timer.validation_bytes[3] == 'T' && timer.in_use == true) {
std::string lamp_names_str = ""; std::string lamp_names_str = "";
for (uint8_t j = 0; j < 16; j++) { for (uint8_t j = 0; j < 16; j++) {
uint8_t k = 0; uint8_t k = 0;
@@ -349,6 +350,7 @@ void DynamicLampComponent::read_timers_to_log() {
ESP_LOGV(TAG, "Timer active for lamps %s", lamp_names_str.c_str()); ESP_LOGV(TAG, "Timer active for lamps %s", lamp_names_str.c_str());
} }
} }
}
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 == true) { if (this->active_lamps_[lamp_number].active == true) {