From 0e0f6cc2c9a5c0e590086849be1d50ec210b6437 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 12:49:15 -1000 Subject: [PATCH 1/2] [toshiba] Replace to_string with stack buffer in debug logging --- esphome/components/toshiba/toshiba.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/esphome/components/toshiba/toshiba.cpp b/esphome/components/toshiba/toshiba.cpp index 5efa70d6b41..b31bf4f5461 100644 --- a/esphome/components/toshiba/toshiba.cpp +++ b/esphome/components/toshiba/toshiba.cpp @@ -1,5 +1,6 @@ #include "toshiba.h" #include "esphome/components/remote_base/toshiba_ac_protocol.h" +#include "esphome/core/helpers.h" #include @@ -428,8 +429,13 @@ void ToshibaClimate::setup() { if (std::isnan(this->target_temperature)) this->target_temperature = 24; // Log final state for debugging HA errors - ESP_LOGV(TAG, "Setup complete - Mode: %d, Fan: %s, Swing: %d, Temp: %.1f", static_cast(this->mode), - this->fan_mode.has_value() ? std::to_string(static_cast(this->fan_mode.value())).c_str() : "NONE", + const char *fan_mode_str = "NONE"; + char fan_mode_buf[4]; // max 3 digits for fan mode enum + null + if (this->fan_mode.has_value()) { + buf_append_printf(fan_mode_buf, sizeof(fan_mode_buf), 0, "%d", static_cast(this->fan_mode.value())); + fan_mode_str = fan_mode_buf; + } + ESP_LOGV(TAG, "Setup complete - Mode: %d, Fan: %s, Swing: %d, Temp: %.1f", static_cast(this->mode), fan_mode_str, static_cast(this->swing_mode), this->target_temperature); } From 94f46191011a05faadab0945f3b469aafeb226d6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 12:50:39 -1000 Subject: [PATCH 2/2] weak --- esphome/components/toshiba/toshiba.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/toshiba/toshiba.cpp b/esphome/components/toshiba/toshiba.cpp index b31bf4f5461..7b5e78af520 100644 --- a/esphome/components/toshiba/toshiba.cpp +++ b/esphome/components/toshiba/toshiba.cpp @@ -428,6 +428,7 @@ void ToshibaClimate::setup() { // Never send nan to HA if (std::isnan(this->target_temperature)) this->target_temperature = 24; +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE // Log final state for debugging HA errors const char *fan_mode_str = "NONE"; char fan_mode_buf[4]; // max 3 digits for fan mode enum + null @@ -437,6 +438,7 @@ void ToshibaClimate::setup() { } ESP_LOGV(TAG, "Setup complete - Mode: %d, Fan: %s, Swing: %d, Temp: %.1f", static_cast(this->mode), fan_mode_str, static_cast(this->swing_mode), this->target_temperature); +#endif } void ToshibaClimate::transmit_state() {