From 39db568ca9e5d028edbd3cea6955a04fde99e1df Mon Sep 17 00:00:00 2001
From: Frank <91616163+softhack007@users.noreply.github.com>
Date: Thu, 27 Jul 2023 12:45:14 +0200
Subject: [PATCH] increase STACK_BUF_SIZE after PR#59
* increase buffer by 64 bytes (sting added in AR usermod)
* better diag message when buffer is full
* change "Arduino max stack" to debug message
---
usermods/audioreactive/audio_reactive.h | 2 +-
wled00/const.h | 2 +-
wled00/util.cpp | 5 ++++-
wled00/wled.cpp | 2 +-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h
index 94cd774b..fb9120aa 100644
--- a/usermods/audioreactive/audio_reactive.h
+++ b/usermods/audioreactive/audio_reactive.h
@@ -2473,7 +2473,7 @@ class AudioReactive : public Usermod {
oappend(SET_F("addOption(dd,'Off',0);"));
oappend(SET_F("addOption(dd,'Send',1);"));
oappend(SET_F("addOption(dd,'Receive',2);"));
- oappend(SET_F("addInfo('AudioReactive:sync:mode',1,'Sync audio data with other WLEDs');"));
+ oappend(SET_F("addInfo('AudioReactive:sync:mode',1,'
Sync audio data with other WLEDs');"));
oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'requires reboot!');")); // 0 is field type, 1 is actual field
diff --git a/wled00/const.h b/wled00/const.h
index 57708bc9..fdf004f4 100644
--- a/wled00/const.h
+++ b/wled00/const.h
@@ -382,7 +382,7 @@
#ifdef ESP8266
#define SETTINGS_STACK_BUF_SIZE 2048
#else
-#define SETTINGS_STACK_BUF_SIZE 3712 // WLEDMM added 512 bytes of margin (was 3096)
+#define SETTINGS_STACK_BUF_SIZE 3776 // WLEDMM added 680 bytes of margin (was 3096) for audioreactive UI
#endif
#ifdef WLED_USE_ETHERNET
diff --git a/wled00/util.cpp b/wled00/util.cpp
index 1ca91043..988eeba2 100644
--- a/wled00/util.cpp
+++ b/wled00/util.cpp
@@ -149,7 +149,10 @@ bool oappend(const char* txt)
{
uint16_t len = strlen(txt);
if (olen + len >= SETTINGS_STACK_BUF_SIZE) {
- DEBUG_PRINTLN(F("oappend() error: buffer full. Increase SETTINGS_STACK_BUF_SIZE."));
+ USER_PRINT(F("oappend() error: buffer full. Increase SETTINGS_STACK_BUF_SIZE for "));
+ USER_PRINTF("%2u bytes \t\"", len /*1 + olen + len - SETTINGS_STACK_BUF_SIZE*/);
+ USER_PRINT(txt);
+ USER_PRINTLN(F("\""));
return false; // buffer full
}
strcpy(obuf + olen, txt);
diff --git a/wled00/wled.cpp b/wled00/wled.cpp
index adfa2b82..663c9c69 100644
--- a/wled00/wled.cpp
+++ b/wled00/wled.cpp
@@ -526,7 +526,7 @@ void WLED::setup()
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap());
#ifdef ARDUINO_ARCH_ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) // unfortunately not availeable in older framework versions
- USER_PRINT(F("\nArduino max stack ")); USER_PRINTLN(getArduinoLoopTaskStackSize());
+ DEBUG_PRINT(F("\nArduino max stack ")); DEBUG_PRINTLN(getArduinoLoopTaskStackSize());
#endif
DEBUG_PRINTF("%s min free stack %d\n", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL)); //WLEDMM
#endif