1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-14 06:38:17 +00:00

fix: rename Dynamic_LampTimer to DynamicLampTimer for consistency in restore logic

This commit is contained in:
Oliver Kleinecke 2025-02-19 16:43:44 +01:00
parent 48f8578f11
commit 9cee344c42

View File

@ -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<unsigned char *>(&timer), 64);
if (timer.validation_bytes == {'V', 'D', 'L', 'T'} && timer.in_use) {
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) {
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);
}