From 11ad03ef1f3ea2a8f465a0a73cbb61c6d9aa7080 Mon Sep 17 00:00:00 2001 From: coylen Date: Mon, 23 Nov 2020 16:02:36 +0000 Subject: [PATCH 1/2] Make looptask stack size configurable Added guarded define to set the stacksize on the main looptask. Advantage of this is that build_flags can be used to provide a different value for the stack size should it be neccessary default behaviour is unaffected --- cores/esp32/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cores/esp32/main.cpp b/cores/esp32/main.cpp index 41f1985b94c..a519ee70a4d 100644 --- a/cores/esp32/main.cpp +++ b/cores/esp32/main.cpp @@ -3,6 +3,10 @@ #include "esp_task_wdt.h" #include "Arduino.h" +#ifndef LOOP_STACK_SIZE +#define LOOP_STACK_SIZE 8192 +#endif + TaskHandle_t loopTaskHandle = NULL; #if CONFIG_AUTOSTART_ARDUINO @@ -25,7 +29,7 @@ extern "C" void app_main() { loopTaskWDTEnabled = false; initArduino(); - xTaskCreateUniversal(loopTask, "loopTask", 8192, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE); + xTaskCreateUniversal(loopTask, "loopTask", LOOP_STACK_SIZE, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE); } #endif From e0d31a23d25209b59fd568d221f0225ad59e4ee2 Mon Sep 17 00:00:00 2001 From: coylen Date: Tue, 1 Dec 2020 15:08:03 +0000 Subject: [PATCH 2/2] Changed variable name changed variable name to CONFIG_ARDUINO_LOOP_STACK_SIZE as requested by @me-no-dev --- cores/esp32/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/esp32/main.cpp b/cores/esp32/main.cpp index a519ee70a4d..e2a61c8ea50 100644 --- a/cores/esp32/main.cpp +++ b/cores/esp32/main.cpp @@ -3,8 +3,8 @@ #include "esp_task_wdt.h" #include "Arduino.h" -#ifndef LOOP_STACK_SIZE -#define LOOP_STACK_SIZE 8192 +#ifndef CONFIG_ARDUINO_LOOP_STACK_SIZE +#define CONFIG_ARDUINO_LOOP_STACK_SIZE 8192 #endif TaskHandle_t loopTaskHandle = NULL; @@ -29,7 +29,7 @@ extern "C" void app_main() { loopTaskWDTEnabled = false; initArduino(); - xTaskCreateUniversal(loopTask, "loopTask", LOOP_STACK_SIZE, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE); + xTaskCreateUniversal(loopTask, "loopTask", CONFIG_ARDUINO_LOOP_STACK_SIZE, NULL, 1, &loopTaskHandle, CONFIG_ARDUINO_RUNNING_CORE); } #endif