From 36dcf2b5b68bf877fd091d3063fc40fd46b459e5 Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Mon, 30 Nov 2015 14:16:58 +0100 Subject: [PATCH] Let prints on GW:s be up to MY_GATEWAY_MAX_SEND_LENGTH large --- libraries/MySensors/core/MyHwATMega328.cpp | 6 +++--- libraries/MySensors/core/MyHwESP8266.cpp | 6 +++--- libraries/MySensors/core/MySigningAtsha204.cpp | 4 ++-- libraries/MySensors/core/MySigningAtsha204Soft.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/MySensors/core/MyHwATMega328.cpp b/libraries/MySensors/core/MyHwATMega328.cpp index 38e16fe..f856953 100644 --- a/libraries/MySensors/core/MyHwATMega328.cpp +++ b/libraries/MySensors/core/MyHwATMega328.cpp @@ -161,9 +161,9 @@ void hwDebugPrint(const char *fmt, ... ) { va_end (args); #ifdef MY_GATEWAY_FEATURE // Truncate message if this is gateway node - vsnprintf_P(fmtBuffer, 60, fmt, args); - fmtBuffer[59] = '\n'; - fmtBuffer[60] = '\0'; + vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args); + fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n'; + fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0'; #else vsnprintf_P(fmtBuffer, 299, fmt, args); #endif diff --git a/libraries/MySensors/core/MyHwESP8266.cpp b/libraries/MySensors/core/MyHwESP8266.cpp index 5e91a75..d834582 100644 --- a/libraries/MySensors/core/MyHwESP8266.cpp +++ b/libraries/MySensors/core/MyHwESP8266.cpp @@ -119,9 +119,9 @@ void hwDebugPrint(const char *fmt, ... ) { va_end (args); #ifdef MY_GATEWAY_FEATURE // Truncate message if this is gateway node - vsnprintf_P(fmtBuffer, 60, fmt, args); - fmtBuffer[59] = '\n'; - fmtBuffer[60] = '\0'; + vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args); + fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n'; + fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0'; #else vsnprintf_P(fmtBuffer, 299, fmt, args); #endif diff --git a/libraries/MySensors/core/MySigningAtsha204.cpp b/libraries/MySensors/core/MySigningAtsha204.cpp index 574b7a0..d9718f6 100644 --- a/libraries/MySensors/core/MySigningAtsha204.cpp +++ b/libraries/MySensors/core/MySigningAtsha204.cpp @@ -60,7 +60,7 @@ static char i2h(uint8_t i) static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, uint8_t sz) { - static char printBuffer[32*2+1]; + static char printBuffer[300]; #ifdef MY_GATEWAY_FEATURE // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) snprintf_P(printBuffer, 299, PSTR("0;0;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE); @@ -74,7 +74,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, printBuffer[sz * 2] = '\0'; #ifdef MY_GATEWAY_FEATURE // Truncate message if this is gateway node - printBuffer[59-strlen_P((const char*)str)] = '\0'; + printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0'; #endif Serial.print(str); if (sz > 0) diff --git a/libraries/MySensors/core/MySigningAtsha204Soft.cpp b/libraries/MySensors/core/MySigningAtsha204Soft.cpp index 9bd3ed6..f7ad922 100644 --- a/libraries/MySensors/core/MySigningAtsha204Soft.cpp +++ b/libraries/MySensors/core/MySigningAtsha204Soft.cpp @@ -62,7 +62,7 @@ static char i2h(uint8_t i) static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, uint8_t sz) { - static char printBuffer[32*2+1]; + static char printBuffer[300]; #ifdef MY_GATEWAY_FEATURE // prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE) snprintf_P(printBuffer, 299, PSTR("0;0;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE); @@ -76,7 +76,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, printBuffer[sz * 2] = '\0'; #ifdef MY_GATEWAY_FEATURE // Truncate message if this is gateway node - printBuffer[59-strlen_P((const char*)str)] = '\0'; + printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0'; #endif Serial.print(str); if (sz > 0)