From fce278489ed1b2a04641aab8d4132e7efd10435e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Tue, 9 Jan 2018 16:08:23 +0100 Subject: [PATCH] Remove limit to debug message length --- code/espurna/config/general.h | 1 - code/espurna/debug.ino | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index a3f438ab..d00ef2ab 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -90,7 +90,6 @@ //------------------------------------------------------------------------------ // General debug options and macros -#define DEBUG_FORMAT_MAX_LENGTH 80 #define DEBUG_SUPPORT DEBUG_SERIAL_SUPPORT || DEBUG_UDP_SUPPORT || DEBUG_TELNET_SUPPORT #if DEBUG_SUPPORT diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index 2b661cf8..65773b5c 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -55,17 +55,17 @@ void debugSend(const char * format, ...) { } -void debugSend_P(PGM_P format, ...) { +void debugSend_P(PGM_P format_P, ...) { - char f[DEBUG_FORMAT_MAX_LENGTH+1]; - memcpy_P(f, format, DEBUG_FORMAT_MAX_LENGTH); + char format[strlen_P(format_P)+1]; + memcpy_P(format, format_P, sizeof(format)); va_list args; - va_start(args, format); + va_start(args, format_P); char test[1]; - int len = ets_vsnprintf(test, 1, f, args) + 1; + int len = ets_vsnprintf(test, 1, format, args) + 1; char * buffer = new char[len]; - ets_vsnprintf(buffer, len, f, args); + ets_vsnprintf(buffer, len, format, args); va_end(args); #if DEBUG_SERIAL_SUPPORT