Let prints on GW:s be up to MY_GATEWAY_MAX_SEND_LENGTH large

This commit is contained in:
Patrick Fallberg
2015-11-30 14:16:58 +01:00
parent 654e804744
commit 36dcf2b5b6
4 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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
@@ -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)
@@ -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)