Skip to content

Commit 36dcf2b

Browse files
committed
Let prints on GW:s be up to MY_GATEWAY_MAX_SEND_LENGTH large
1 parent 654e804 commit 36dcf2b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Diff for: libraries/MySensors/core/MyHwATMega328.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ void hwDebugPrint(const char *fmt, ... ) {
161161
va_end (args);
162162
#ifdef MY_GATEWAY_FEATURE
163163
// Truncate message if this is gateway node
164-
vsnprintf_P(fmtBuffer, 60, fmt, args);
165-
fmtBuffer[59] = '\n';
166-
fmtBuffer[60] = '\0';
164+
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
165+
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
166+
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
167167
#else
168168
vsnprintf_P(fmtBuffer, 299, fmt, args);
169169
#endif

Diff for: libraries/MySensors/core/MyHwESP8266.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ void hwDebugPrint(const char *fmt, ... ) {
119119
va_end (args);
120120
#ifdef MY_GATEWAY_FEATURE
121121
// Truncate message if this is gateway node
122-
vsnprintf_P(fmtBuffer, 60, fmt, args);
123-
fmtBuffer[59] = '\n';
124-
fmtBuffer[60] = '\0';
122+
vsnprintf_P(fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, fmt, args);
123+
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1] = '\n';
124+
fmtBuffer[MY_GATEWAY_MAX_SEND_LENGTH] = '\0';
125125
#else
126126
vsnprintf_P(fmtBuffer, 299, fmt, args);
127127
#endif

Diff for: libraries/MySensors/core/MySigningAtsha204.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static char i2h(uint8_t i)
6060

6161
static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, uint8_t sz)
6262
{
63-
static char printBuffer[32*2+1];
63+
static char printBuffer[300];
6464
#ifdef MY_GATEWAY_FEATURE
6565
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
6666
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,
7474
printBuffer[sz * 2] = '\0';
7575
#ifdef MY_GATEWAY_FEATURE
7676
// Truncate message if this is gateway node
77-
printBuffer[59-strlen_P((const char*)str)] = '\0';
77+
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
7878
#endif
7979
Serial.print(str);
8080
if (sz > 0)

Diff for: libraries/MySensors/core/MySigningAtsha204Soft.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static char i2h(uint8_t i)
6262

6363
static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf, uint8_t sz)
6464
{
65-
static char printBuffer[32*2+1];
65+
static char printBuffer[300];
6666
#ifdef MY_GATEWAY_FEATURE
6767
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
6868
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,
7676
printBuffer[sz * 2] = '\0';
7777
#ifdef MY_GATEWAY_FEATURE
7878
// Truncate message if this is gateway node
79-
printBuffer[59-strlen_P((const char*)str)] = '\0';
79+
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
8080
#endif
8181
Serial.print(str);
8282
if (sz > 0)

0 commit comments

Comments
 (0)