mirror of
https://github.com/esphome/esphome.git
synced 2025-03-14 06:38:17 +00:00
fix: update add_timer method to use unsigned char for lamp_name buffer and adjust type casting
This commit is contained in:
parent
4401da60dd
commit
6d12e72ad0
@ -231,10 +231,10 @@ 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();
|
||||
char lamp_name_buffer[32];
|
||||
strncpy(lamp_name_buffer, lamp_name.c_str(), 32);
|
||||
unsigned char lamp_name_buffer[32];
|
||||
strncpy(static_cast<char *>(lamp_name_buffer), lamp_name.c_str(), 32);
|
||||
DynamicLampTimer new_timer;
|
||||
new_timer.lamp_name = static_cast<unsigned char*>(static_cast<void*>(&lamp_name_buffer));
|
||||
new_timer.lamp_name = lamp_name_buffer;
|
||||
new_timer.active = timer_active;
|
||||
new_timer.mode = mode;
|
||||
new_timer.hour = hour;
|
||||
|
Loading…
x
Reference in New Issue
Block a user