From 9cee344c4298ab1afa4952c4f9fea00f9d5bec8f Mon Sep 17 00:00:00 2001 From: Oliver Kleinecke Date: Wed, 19 Feb 2025 16:43:44 +0100 Subject: [PATCH] fix: rename Dynamic_LampTimer to DynamicLampTimer for consistency in restore logic --- esphome/components/dynamic_lamp/dynamic_lamp.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/esphome/components/dynamic_lamp/dynamic_lamp.cpp b/esphome/components/dynamic_lamp/dynamic_lamp.cpp index 5d9e6400f6..0bb81264a9 100644 --- a/esphome/components/dynamic_lamp/dynamic_lamp.cpp +++ b/esphome/components/dynamic_lamp/dynamic_lamp.cpp @@ -368,7 +368,7 @@ void DynamicLampComponent::restore_timers_() { switch (this->save_mode_) { case SAVE_MODE_NONE: for (uint8_t i = 0; i < 256; i++) { - this->timers_[i] = Dynamic_LampTimer(); + this->timers_[i] = DynamicLampTimer(); this->timers_[i].in_use = false; } break; @@ -381,8 +381,12 @@ void DynamicLampComponent::restore_timers_() { DynamicLampTimer timer; std::string lamp_names_str; for (uint8_t i = 0; i < 256; i++) { - this->fram_->read((0x4000h + (i * 64)), reinterpret_cast(&timer), 64); - if (timer.validation_bytes == {'V', 'D', 'L', 'T'} && timer.in_use) { + this->fram_->read((0x4000 + (i * 64)), reinterpret_cast(&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) { this->timers_[i] = timer; lamp_names_str = ""; for (uint8_t j = 0; j < 16; j++) { @@ -400,7 +404,7 @@ void DynamicLampComponent::restore_timers_() { timer.wednesday, timer.thursday, timer.friday, timer.saturday, timer.sunday); ESP_LOGVV(TAG, "Timer active for lamps %s", lamp_names_str.c_str()); } else { - this->timers_[i] = Dynamic_LampTimer(); + this->timers_[i] = DynamicLampTimer(); this->timers_[i].in_use = false; ESP_LOGVV(TAG, "Timer save slot %" PRIu8 " did not contain valid record, initializing unused empty timer slot", i); }