|
|
@ -62,11 +62,15 @@ void _debugSend(char * message) { |
|
|
|
|
|
|
|
#if DEBUG_WEB_SUPPORT
|
|
|
|
if (wsConnected() && (getFreeHeap() > 10000)) { |
|
|
|
char buffer[strlen(message) + 24]; // 8 char timestamp [234567] + space + 14 char json wrap
|
|
|
|
String m = String(message); |
|
|
|
m.replace("\"", """); |
|
|
|
m.replace("{", "{"); |
|
|
|
m.replace("}", "}"); |
|
|
|
char buffer[m.length() + 24]; |
|
|
|
#if DEBUG_ADD_TIMESTAMP
|
|
|
|
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s%s\"}"), timestamp, message); |
|
|
|
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s%s\"}"), timestamp, m.c_str()); |
|
|
|
#else
|
|
|
|
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), message); |
|
|
|
snprintf_P(buffer, sizeof(buffer), PSTR("{\"weblog\": \"%s\"}"), m.c_str()); |
|
|
|
#endif
|
|
|
|
wsSend(buffer); |
|
|
|
} |
|
|
|