Fix unquoted non-json data

Fix unquoted non-json data ()
This commit is contained in:
Theo Arends 2020-04-01 14:39:43 +02:00
parent ec899817aa
commit caff54da7c
2 changed files with 4 additions and 4 deletions

View File

@ -1286,9 +1286,9 @@ void SerialInput(void)
char hex_char[(serial_in_byte_counter * 2) + 2];
bool assume_json = (!Settings.flag.mqtt_serial_raw && (serial_in_buffer[0] == '{'));
Response_P(PSTR("{\"" D_JSON_SERIALRECEIVED "\":%s%s%s}"),
(assume_json) ? "" : """",
(assume_json) ? "" : "\"",
(Settings.flag.mqtt_serial_raw) ? ToHex_P((unsigned char*)serial_in_buffer, serial_in_byte_counter, hex_char, sizeof(hex_char)) : serial_in_buffer,
(assume_json) ? "" : """");
(assume_json) ? "" : "\"");
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SERIALRECEIVED));
XdrvRulesProcess();
serial_in_byte_counter = 0;

View File

@ -73,9 +73,9 @@ void SerialBridgeInput(void)
char hex_char[(serial_bridge_in_byte_counter * 2) + 2];
bool assume_json = (!serial_bridge_raw && (serial_bridge_buffer[0] == '{'));
Response_P(PSTR("{\"" D_JSON_SSERIALRECEIVED "\":%s%s%s}"),
(assume_json) ? "" : """",
(assume_json) ? "" : "\"",
(serial_bridge_raw) ? ToHex_P((unsigned char*)serial_bridge_buffer, serial_bridge_in_byte_counter, hex_char, sizeof(hex_char)) : serial_bridge_buffer,
(assume_json) ? "" : """");
(assume_json) ? "" : "\"");
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED));
XdrvRulesProcess();
serial_bridge_in_byte_counter = 0;