From bb45bee7f870989bc7688f4ef4f82f7bb5581c0e Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:01:55 +0200 Subject: [PATCH] oappend() debug message when buffer is full oappend() silently discards strings when the buffer is full, leading to strange effects like half-working UI pages. The new debug message will help developers to understand what could be wrong. --- wled00/util.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wled00/util.cpp b/wled00/util.cpp index b8dea2555..57f221d43 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -148,8 +148,14 @@ bool oappendi(int i) bool oappend(const char* txt) { uint16_t len = strlen(txt); - if (olen + len >= SETTINGS_STACK_BUF_SIZE) + if (olen + len >= SETTINGS_STACK_BUF_SIZE) { +#ifdef WLED_DEBUG + DEBUG_PRINT(F("oappend() buffer overflow. Cannnot append ")); + DEBUG_PRINT(len); DEBUG_PRINT(F(" bytes \t\"")); + DEBUG_PRINT(txt); DEBUG_PRINTLN(F("\"")); +#endif return false; // buffer full + } strcpy(obuf + olen, txt); olen += len; return true;