mirror of
https://github.com/esphome/esphome.git
synced 2026-02-20 16:35:37 -07:00
dry
This commit is contained in:
@@ -72,11 +72,6 @@ struct Timer {
|
||||
uint32_t seconds_left;
|
||||
bool is_active;
|
||||
|
||||
std::string to_string() const {
|
||||
return str_sprintf("Timer(id=%s, name=%s, total_seconds=%" PRIu32 ", seconds_left=%" PRIu32 ", is_active=%s)",
|
||||
this->id.c_str(), this->name.c_str(), this->total_seconds, this->seconds_left,
|
||||
YESNO(this->is_active));
|
||||
}
|
||||
/// Buffer size for to_str() - sufficient for typical timer names
|
||||
static constexpr size_t TO_STR_BUFFER_SIZE = 128;
|
||||
/// Format to buffer, returns pointer to buffer (may truncate long names)
|
||||
@@ -86,6 +81,10 @@ struct Timer {
|
||||
this->id.c_str(), this->name.c_str(), this->total_seconds, this->seconds_left, YESNO(this->is_active));
|
||||
return buffer.data();
|
||||
}
|
||||
std::string to_string() const {
|
||||
char buffer[TO_STR_BUFFER_SIZE];
|
||||
return this->to_str(buffer);
|
||||
}
|
||||
};
|
||||
|
||||
struct WakeWord {
|
||||
|
||||
Reference in New Issue
Block a user