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

fix: update DynamicLampTimer struct to use lamp_name and adjust logging for timer details

This commit is contained in:
Oliver Kleinecke 2025-02-18 14:26:37 +01:00
parent 24d4029264
commit 1a76c1b624
2 changed files with 3 additions and 3 deletions

View File

@ -254,7 +254,7 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
new_timer.end_date = end_date;
unsigned char* timer_as_bytes = static_cast<unsigned char*>(static_cast<void*>(&new_timer));
ESP_LOGV(TAG, "Added new timer for lamp %s, active %d, mode %d, hour %d, minute %d, monday %d, tuesday %d, wednesday %d, thursday %d, friday %d, saturday %d, sunday %d",
new_timer.name, new_timer.active, new_timer.mode, new_timer.hour, new_timer.minute, new_timer.monday, new_timer.tuesday, new_timer.wednesday,
new_timer.lamp_name, new_timer.active, new_timer.mode, new_timer.hour, new_timer.minute, new_timer.monday, new_timer.tuesday, new_timer.wednesday,
new_timer.thursday, new_timer.friday, new_timer.saturday, new_timer.sunday);
ESP_LOGV(TAG, "Size of struct is %" PRIu8 "", static_cast<uint8_t>(sizeof(new_timer)));
//this->fram_->write(2048, reinterpret_cast<unsigned char *>(lamp_name_buffer), 32);
@ -269,7 +269,7 @@ void DynamicLampComponent::read_timers_to_log() {
DynamicLampTimer timer;
this->fram_->read((2048), reinterpret_cast<unsigned char *>(&timer), 56);
ESP_LOGV(TAG, "Timer found for lamp %s: %d, mode: %d, hour: %d, minute: %d, monday: %d, tuesday: %d, wednesday: %d, thursday: %d, friday: %d, saturday: %d, sunday: %d",
timer.name, timer.active, timer.mode, timer.hour, timer.minute, timer.monday, timer.tuesday,
timer.lamp_name, timer.active, timer.mode, timer.hour, timer.minute, timer.monday, timer.tuesday,
timer.wednesday, timer.thursday, timer.friday, timer.saturday, timer.sunday);
}
}

View File

@ -69,7 +69,7 @@ struct CombinedLamp {
};
struct DynamicLampTimer {
unsigned char[32]: 256;
unsigned char lamp_name[32]: 256;
uint8_t mode : 1;
uint8_t hour : 5;
uint8_t minute : 6;