diff --git a/src/Networking/Networking.cpp b/src/Networking/Networking.cpp index 83df2f1..550ae6b 100644 --- a/src/Networking/Networking.cpp +++ b/src/Networking/Networking.cpp @@ -555,7 +555,12 @@ void Networking::networkReconnectTaskFn(void* param) { void Networking::reconnectionTimerCallback(TimerHandle_t xTimer) { if (_instance) { - xTaskCreate(networkReconnectTaskFn, "netRecon", 3072, _instance, 5, NULL); + // If the task can't be created (fragmented heap), re-arm the one-shot + // timer to try again next interval. Before, a single failure ended the + // reconnect chain silently. No LOG here — Tmr Svc stack is 2KB. + if (xTaskCreate(networkReconnectTaskFn, "netRecon", 3072, _instance, 5, NULL) != pdPASS) { + xTimerStart(xTimer, 0); + } } } diff --git a/src/main.cpp b/src/main.cpp index 59c4455..c252a7a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -459,7 +459,11 @@ static void ntpSyncTask(void* param) { // Non-blocking NTP sync timer callback — defers work to a task (Tmr Svc stack is only 2KB) void ntpSyncTimerCallback(TimerHandle_t xTimer) { - xTaskCreate(ntpSyncTask, "ntpSync", 5120, NULL, 5, NULL); + // Task creation can fail on a fragmented heap — re-arm the one-shot timer + // and retry in 3s instead of silently skipping the sync. + if (xTaskCreate(ntpSyncTask, "ntpSync", 5120, NULL, 5, NULL) != pdPASS) { + xTimerStart(xTimer, 0); + } } #endif