diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 00fdd00f9..6741df57c 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -1854,8 +1854,7 @@ void SerialInput(void) } else { ResponseAppend_P(PSTR("\"")); if (Settings->flag.mqtt_serial_raw) { - char hex_char[(TasmotaGlobal.serial_in_byte_counter * 2) + 2]; - ResponseAppend_P(ToHex_P((unsigned char*)TasmotaGlobal.serial_in_buffer, TasmotaGlobal.serial_in_byte_counter, hex_char, sizeof(hex_char))); + ResponseAppend_P(PSTR("%*_H"), TasmotaGlobal.serial_in_byte_counter, TasmotaGlobal.serial_in_buffer); } else { ResponseAppend_P(EscapeJSONString(TasmotaGlobal.serial_in_buffer).c_str()); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino index e8c156a5d..8b5617b47 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_08_serial_bridge.ino @@ -158,8 +158,7 @@ void SerialBridgeInput(void) { } else { ResponseAppend_P(PSTR("\"")); if (serial_bridge_raw) { - char hex_char[(serial_bridge_in_byte_counter * 2) + 2]; - ResponseAppend_P(ToHex_P((unsigned char*)serial_bridge_buffer, serial_bridge_in_byte_counter, hex_char, sizeof(hex_char))); + ResponseAppend_P(PSTR("%*_H"), serial_bridge_in_byte_counter, serial_bridge_buffer); } else { ResponseAppend_P(EscapeJSONString(serial_bridge_buffer).c_str()); } @@ -171,7 +170,7 @@ void SerialBridgeInput(void) { XdrvRulesProcess(0); } else { MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); - } + } serial_bridge_in_byte_counter = 0; } }