Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7574b29

Browse filesBrowse files
committed
fix(littlefs): Converted core disableWDT functions to bool to check if they were previously enabled
1 parent 496b841 commit 7574b29
Copy full SHA for 7574b29

File tree

3 files changed

+10
-8
lines changed
Filter options

3 files changed

+10
-8
lines changed

‎cores/esp32/esp32-hal-misc.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-misc.c
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ void enableCore0WDT() {
156156
}
157157
}
158158

159-
void disableCore0WDT() {
159+
bool disableCore0WDT() {
160160
TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCore(0);
161-
if (idle_0 == NULL || esp_task_wdt_delete(idle_0) != ESP_OK) {
161+
if (idle_0 == NULL || esp_task_wdt_status(idle_0) || esp_task_wdt_delete(idle_0) != ESP_OK) {
162162
log_e("Failed to remove Core 0 IDLE task from WDT");
163+
return false;
163164
}
165+
return true;
164166
}
165167

166168
#ifndef CONFIG_FREERTOS_UNICORE
@@ -171,9 +173,9 @@ void enableCore1WDT() {
171173
}
172174
}
173175

174-
void disableCore1WDT() {
176+
bool disableCore1WDT() {
175177
TaskHandle_t idle_1 = xTaskGetIdleTaskHandleForCore(1);
176-
if (idle_1 == NULL || esp_task_wdt_delete(idle_1) != ESP_OK) {
178+
if (idle_1 == NULL || esp_task_wdt_status(idle_1) || esp_task_wdt_delete(idle_1) != ESP_OK) {
177179
log_e("Failed to remove Core 1 IDLE task from WDT");
178180
}
179181
}

‎cores/esp32/esp32-hal.h

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ void feedLoopWDT();
121121

122122
//enable/disable WDT for the IDLE task on Core 0 (SYSTEM)
123123
void enableCore0WDT();
124-
void disableCore0WDT();
124+
bool disableCore0WDT();
125125
#ifndef CONFIG_FREERTOS_UNICORE
126126
//enable/disable WDT for the IDLE task on Core 1 (Arduino)
127127
void enableCore1WDT();
128-
void disableCore1WDT();
128+
bool disableCore1WDT();
129129
#endif
130130

131131
//if xCoreID < 0 or CPU is unicore, it will use xTaskCreate, else xTaskCreatePinnedToCore

‎libraries/LittleFS/src/LittleFS.cpp

Copy file name to clipboardExpand all lines: libraries/LittleFS/src/LittleFS.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ void LittleFSFS::end() {
9595
}
9696

9797
bool LittleFSFS::format() {
98-
disableCore0WDT();
98+
bool wdt_active = disableCore0WDT();
9999
esp_err_t err = esp_littlefs_format(partitionLabel_);
100-
enableCore0WDT();
100+
if (wdt_active) enableCore0WDT();
101101
if (err) {
102102
log_e("Formatting LittleFS failed! Error: %d", err);
103103
return false;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.