Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(littlefs): Converted core disableWDT functions to bool #10896

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cores/esp32/esp32-hal-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ void enableCore0WDT() {
}
}

void disableCore0WDT() {
bool disableCore0WDT() {
TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCore(0);
if (idle_0 == NULL || esp_task_wdt_delete(idle_0) != ESP_OK) {
if (idle_0 == NULL || esp_task_wdt_status(idle_0) || esp_task_wdt_delete(idle_0) != ESP_OK) {
log_e("Failed to remove Core 0 IDLE task from WDT");
return false;
}
return true;
}

#ifndef CONFIG_FREERTOS_UNICORE
Expand All @@ -171,11 +173,13 @@ void enableCore1WDT() {
}
}

void disableCore1WDT() {
bool disableCore1WDT() {
TaskHandle_t idle_1 = xTaskGetIdleTaskHandleForCore(1);
if (idle_1 == NULL || esp_task_wdt_delete(idle_1) != ESP_OK) {
if (idle_1 == NULL || esp_task_wdt_status(idle_1) || esp_task_wdt_delete(idle_1) != ESP_OK) {
log_e("Failed to remove Core 1 IDLE task from WDT");
return false;
}
return true;
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ void feedLoopWDT();

//enable/disable WDT for the IDLE task on Core 0 (SYSTEM)
void enableCore0WDT();
void disableCore0WDT();
bool disableCore0WDT();
#ifndef CONFIG_FREERTOS_UNICORE
//enable/disable WDT for the IDLE task on Core 1 (Arduino)
void enableCore1WDT();
void disableCore1WDT();
bool disableCore1WDT();
#endif

//if xCoreID < 0 or CPU is unicore, it will use xTaskCreate, else xTaskCreatePinnedToCore
Expand Down
6 changes: 4 additions & 2 deletions libraries/LittleFS/src/LittleFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ void LittleFSFS::end() {
}

bool LittleFSFS::format() {
disableCore0WDT();
bool wdt_active = disableCore0WDT();
esp_err_t err = esp_littlefs_format(partitionLabel_);
enableCore0WDT();
if (wdt_active) {
enableCore0WDT();
}
if (err) {
log_e("Formatting LittleFS failed! Error: %d", err);
return false;
Expand Down
Loading