1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00

[mitsubishi] Use stack buffer for hex formatting in verbose logging

This commit is contained in:
J. Nick Koston
2025-12-31 16:31:18 -10:00
parent 3c9ed126a6
commit b7d9e3e847

View File

@@ -1,4 +1,5 @@
#include "mitsubishi.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome {
@@ -6,6 +7,9 @@ namespace mitsubishi {
static const char *const TAG = "mitsubishi.climate";
// IR frame size for Mitsubishi climate
static constexpr size_t MITSUBISHI_FRAME_SIZE = 18;
const uint8_t MITSUBISHI_OFF = 0x00;
const uint8_t MITSUBISHI_MODE_AUTO = 0x20;
@@ -388,7 +392,10 @@ bool MitsubishiClimate::on_receive(remote_base::RemoteReceiveData data) {
break;
}
ESP_LOGV(TAG, "Receiving: %s", format_hex_pretty(state_frame, 18).c_str());
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
char hex_buf[format_hex_pretty_size(MITSUBISHI_FRAME_SIZE)];
#endif
ESP_LOGV(TAG, "Receiving: %s", format_hex_pretty_to(hex_buf, state_frame, MITSUBISHI_FRAME_SIZE));
this->publish_state();
return true;