|
@ -18,18 +18,16 @@ WiFiUDP udpDebug; |
|
|
|
|
|
|
|
|
void debugSend(const char * format, ...) { |
|
|
void debugSend(const char * format, ...) { |
|
|
|
|
|
|
|
|
char buffer[DEBUG_MESSAGE_MAX_LENGTH+1]; |
|
|
|
|
|
|
|
|
|
|
|
va_list args; |
|
|
va_list args; |
|
|
va_start(args, format); |
|
|
va_start(args, format); |
|
|
int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, format, args); |
|
|
|
|
|
|
|
|
char test[1]; |
|
|
|
|
|
int len = ets_vsnprintf(test, 1, format, args) + 1; |
|
|
|
|
|
char * buffer = new char[len]; |
|
|
|
|
|
ets_vsnprintf(buffer, len, format, args); |
|
|
va_end(args); |
|
|
va_end(args); |
|
|
|
|
|
|
|
|
#if DEBUG_SERIAL_SUPPORT
|
|
|
#if DEBUG_SERIAL_SUPPORT
|
|
|
DEBUG_PORT.printf(buffer); |
|
|
DEBUG_PORT.printf(buffer); |
|
|
if (len > DEBUG_MESSAGE_MAX_LENGTH) { |
|
|
|
|
|
DEBUG_PORT.printf(" (...)\n"); |
|
|
|
|
|
} |
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if DEBUG_UDP_SUPPORT
|
|
|
#if DEBUG_UDP_SUPPORT
|
|
@ -38,9 +36,6 @@ void debugSend(const char * format, ...) { |
|
|
#endif
|
|
|
#endif
|
|
|
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); |
|
|
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); |
|
|
udpDebug.write(buffer); |
|
|
udpDebug.write(buffer); |
|
|
if (len > DEBUG_MESSAGE_MAX_LENGTH) { |
|
|
|
|
|
udpDebug.write(" (...)\n"); |
|
|
|
|
|
} |
|
|
|
|
|
udpDebug.endPacket(); |
|
|
udpDebug.endPacket(); |
|
|
delay(1); |
|
|
delay(1); |
|
|
#if SYSTEM_CHECK_ENABLED
|
|
|
#if SYSTEM_CHECK_ENABLED
|
|
@ -56,21 +51,19 @@ void debugSend(const char * format, ...) { |
|
|
|
|
|
|
|
|
void debugSend_P(PGM_P format, ...) { |
|
|
void debugSend_P(PGM_P format, ...) { |
|
|
|
|
|
|
|
|
char f[DEBUG_MESSAGE_MAX_LENGTH+1]; |
|
|
|
|
|
memcpy_P(f, format, DEBUG_MESSAGE_MAX_LENGTH); |
|
|
|
|
|
|
|
|
|
|
|
char buffer[DEBUG_MESSAGE_MAX_LENGTH+1]; |
|
|
|
|
|
|
|
|
char f[DEBUG_FORMAT_MAX_LENGTH+1]; |
|
|
|
|
|
memcpy_P(f, format, DEBUG_FORMAT_MAX_LENGTH); |
|
|
|
|
|
|
|
|
va_list args; |
|
|
va_list args; |
|
|
va_start(args, format); |
|
|
va_start(args, format); |
|
|
int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, f, args); |
|
|
|
|
|
|
|
|
char test[1]; |
|
|
|
|
|
int len = ets_vsnprintf(test, 1, f, args) + 1; |
|
|
|
|
|
char * buffer = new char[len]; |
|
|
|
|
|
ets_vsnprintf(buffer, len, f, args); |
|
|
va_end(args); |
|
|
va_end(args); |
|
|
|
|
|
|
|
|
#if DEBUG_SERIAL_SUPPORT
|
|
|
#if DEBUG_SERIAL_SUPPORT
|
|
|
DEBUG_PORT.printf(buffer); |
|
|
DEBUG_PORT.printf(buffer); |
|
|
if (len > DEBUG_MESSAGE_MAX_LENGTH) { |
|
|
|
|
|
DEBUG_PORT.printf(" (...)\n"); |
|
|
|
|
|
} |
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if DEBUG_UDP_SUPPORT
|
|
|
#if DEBUG_UDP_SUPPORT
|
|
@ -79,9 +72,6 @@ void debugSend_P(PGM_P format, ...) { |
|
|
#endif
|
|
|
#endif
|
|
|
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); |
|
|
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); |
|
|
udpDebug.write(buffer); |
|
|
udpDebug.write(buffer); |
|
|
if (len > DEBUG_MESSAGE_MAX_LENGTH) { |
|
|
|
|
|
udpDebug.write(" (...)\n"); |
|
|
|
|
|
} |
|
|
|
|
|
udpDebug.endPacket(); |
|
|
udpDebug.endPacket(); |
|
|
delay(1); |
|
|
delay(1); |
|
|
#if SYSTEM_CHECK_ENABLED
|
|
|
#if SYSTEM_CHECK_ENABLED
|
|
|