1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

fix: change lamp_name_buffer type to char and update write call for new_timer in add_timer method

This commit is contained in:
Oliver Kleinecke
2025-02-18 13:50:18 +01:00
parent 98b1f29c6a
commit 7ff2ba1686

View File

@@ -231,7 +231,7 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
uint8_t minute, bool monday, bool tuesday, bool wednesday, bool thursday,
bool friday, bool saturday, bool sunday) {
//unsigned char* lamp_name_cstr = lamp_name.c_str();
unsigned char lamp_name_buffer[32];
char lamp_name_buffer[32];
strncpy(lamp_name_buffer, lamp_name.data(), 32);
DynamicLampTimer new_timer;
new_timer.active = timer_active;
@@ -256,7 +256,7 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
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, lamp_name_buffer, 32);
this->fram_->write((2048 + 32), new_timer, 24);
this->fram_->write((2048 + 32), &new_timer, 24);
return true;
}