Skip to content

Commit 0966b30

Browse files
committed
main: Allocate pre-reboot task's memory when needed
Avoid 1k static memory allocation that is only used at reboot and only when the watchdog module is not available.
1 parent edd7cb5 commit 0966b30

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

software/src/main.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ static const char *pre_reboot_message = "Pre-reboot stage lasted longer than fiv
142142

143143
#if !MODULE_WATCHDOG_AVAILABLE()
144144

145-
#define PRE_REBOOT_STACK_SIZE 768
146-
147-
static StaticTask_t pre_reboot_task_buffer;
148-
static StackType_t pre_reboot_stack[PRE_REBOOT_STACK_SIZE];
149-
150145
static void pre_reboot_task(void *arg)
151146
{
152147
#pragma GCC diagnostic push
@@ -180,14 +175,13 @@ static void pre_reboot(void)
180175
#if MODULE_WATCHDOG_AVAILABLE()
181176
watchdog.add("pre_reboot", pre_reboot_message, PRE_REBOOT_MAX_DURATION, 0, true);
182177
#else
183-
xTaskCreateStaticPinnedToCore(
178+
xTaskCreatePinnedToCore(
184179
pre_reboot_task,
185180
"pre_reboot_task",
186-
PRE_REBOOT_STACK_SIZE,
181+
640,
187182
nullptr,
188183
ESP_TASK_PRIO_MAX,
189-
pre_reboot_stack,
190-
&pre_reboot_task_buffer,
184+
nullptr,
191185
1);
192186
#endif
193187

0 commit comments

Comments
 (0)