[shelly_dimmer] Use stack buffer for hex formatting in command logging

This commit is contained in:
J. Nick Koston
2025-12-29 09:31:17 -10:00
parent 60c6d94083
commit 29a64b9113

View File

@@ -270,7 +270,10 @@ void ShellyDimmer::send_settings_() {
}
bool ShellyDimmer::send_command_(uint8_t cmd, const uint8_t *const payload, uint8_t len) {
ESP_LOGD(TAG, "Sending command: 0x%02x (%d bytes) payload 0x%s", cmd, len, format_hex(payload, len).c_str());
// Buffer for hex formatting: max payload size (SETTINGS=10 bytes) * 2 chars + null = 21 bytes
char hex_buf[SHELLY_DIMMER_PROTO_CMD_SETTINGS_SIZE * 2 + 1];
ESP_LOGD(TAG, "Sending command: 0x%02x (%d bytes) payload 0x%s", cmd, len,
format_hex_to(hex_buf, sizeof(hex_buf), payload, len));
// Prepare a command frame.
uint8_t frame[SHELLY_DIMMER_PROTO_MAX_FRAME_SIZE];