mirror of
https://github.com/esphome/esphome.git
synced 2025-09-20 04:02:21 +01:00
fix: correct lamp name handling in DynamicLampComponent and update struct definition
This commit is contained in:
@@ -232,7 +232,6 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
|
|||||||
bool friday, bool saturday, bool sunday) {
|
bool friday, bool saturday, bool sunday) {
|
||||||
char const *lamp_name_cstr = lamp_name.c_str();
|
char const *lamp_name_cstr = lamp_name.c_str();
|
||||||
DynamicLampTimer new_timer;
|
DynamicLampTimer new_timer;
|
||||||
std::strncpy(new_timer.lamp_name, lamp_name_cstr, 32);
|
|
||||||
new_timer.active = timer_active;
|
new_timer.active = timer_active;
|
||||||
new_timer.mode = mode;
|
new_timer.mode = mode;
|
||||||
new_timer.hour = hour;
|
new_timer.hour = hour;
|
||||||
@@ -250,7 +249,7 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
|
|||||||
new_timer.begin_date = begin_date;
|
new_timer.begin_date = begin_date;
|
||||||
new_timer.end_date = end_date;
|
new_timer.end_date = end_date;
|
||||||
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",
|
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.lamp_name, new_timer.active, new_timer.mode, new_timer.hour, new_timer.minute, new_timer.monday, new_timer.tuesday, new_timer.wednesday,
|
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);
|
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)));
|
ESP_LOGV(TAG, "Size of struct is %" PRIu8 "", static_cast<uint8_t>(sizeof(new_timer)));
|
||||||
return true;
|
return true;
|
||||||
|
@@ -68,7 +68,6 @@ struct CombinedLamp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct DynamicLampTimer {
|
struct DynamicLampTimer {
|
||||||
char lamp_name[32] : 256;
|
|
||||||
uint8_t mode : 1;
|
uint8_t mode : 1;
|
||||||
uint8_t hour : 5;
|
uint8_t hour : 5;
|
||||||
uint8_t minute : 6;
|
uint8_t minute : 6;
|
||||||
|
Reference in New Issue
Block a user