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

fix: streamline read_timers_to_log function by removing unnecessary loop and improving log message format

This commit is contained in:
Oliver Kleinecke 2025-02-19 13:02:11 +01:00
parent b9f1611145
commit a3a2eff663

View File

@ -302,19 +302,14 @@ std::vector<bool> DynamicLampComponent::build_lamp_list_from_list_str_(std::stri
} }
void DynamicLampComponent::read_timers_to_log() { void DynamicLampComponent::read_timers_to_log() {
uint8_t i = 0; DynamicLampTimer timer;
for (i = 0; i < 16; i++) { this->fram_->read((2048), reinterpret_cast<unsigned char *>(&timer), 24);
if (this->active_lamps_[i].active) { for (uint8_t j = 0; j < 16; j++) {
DynamicLampTimer timer; bool lamp_included = static_cast<bool>(timer.lamp_list[j / 8] & (1 << (j % 8)));
this->fram_->read((2048), reinterpret_cast<unsigned char *>(&timer), 24); if (lamp_included && this->active_lamps_[j].active) {
for (uint8_t j = 0; j < 16; j++) { ESP_LOGV(TAG, "Timer found for lamp %s [ active: %d, action: %d, hour: %d, minute: %d, monday: %d, tuesday: %d, wednesday: %d, thursday: %d, friday: %d, saturday: %d, sunday: %d ]",
bool lamp_included = static_cast<bool>(timer.lamp_list[j / 8] & (1 << (j % 8))); this->active_lamps_[j].name, timer.active, timer.action, timer.hour, timer.minute, timer.monday, timer.tuesday,
if (lamp_included && this->active_lamps_[j].active) { timer.wednesday, timer.thursday, timer.friday, timer.saturday, timer.sunday);
ESP_LOGV(TAG, "Timer found for lamp %s |: active: %d, action: %d, hour: %d, minute: %d, monday: %d, tuesday: %d, wednesday: %d, thursday: %d, friday: %d, saturday: %d, sunday: %d",
this->active_lamps_[j].name, timer.active, timer.action, timer.hour, timer.minute, timer.monday, timer.tuesday,
timer.wednesday, timer.thursday, timer.friday, timer.saturday, timer.sunday);
}
}
} }
} }
} }