Fix IDLE0 starvation with vTaskDelay(1)

This commit is contained in:
2026-05-10 19:28:41 +02:00
parent 382433b91f
commit ab0173a5b6
2 changed files with 28 additions and 14 deletions

View File

@@ -60,28 +60,35 @@ void UploadManager::processPendingUploads() {
File dir = SD.open(path);
if (!dir || !dir.isDirectory()) {
if(dir) dir.close();
vTaskDelay(1); // yield do IDLE0 między katalogami
continue;
}
for (File f = dir.openNextFile(); f; f = dir.openNextFile()) {
vTaskDelay(1); // yield do IDLE0 przy każdym pliku — zapobiega głodzeniu WDT
if (f.isDirectory()) { f.close(); continue; }
String childPath = String(f.name());
if (!childPath.startsWith("/")) {
childPath = path + "/" + childPath;
}
if (childPath.endsWith(".wmt")) {
if (childPath == capture_.getCurrentCapturePath()) continue;
ESP_LOGI(TAG_UPLOAD, "Found pending file: %s", childPath.c_str());
uploadFile(childPath);
delay(1000);
}
f.close();
// Pomijamy pliki .upl (już wgrane) i inne rozszerzenia
if (!childPath.endsWith(".wmt")) continue;
// Pomijamy plik aktualnie zapisywany przez pomiar
if (childPath == capture_.getCurrentCapturePath()) continue;
Watchdog::feed();
if (WiFi.status() != WL_CONNECTED) {
dir.close();
return;
}
ESP_LOGI(TAG_UPLOAD, "Found pending file: %s", childPath.c_str());
uploadFile(childPath);
// Krótka przerwa po uploaderze — pozwala IDLE0 na reset WDT
vTaskDelay(pdMS_TO_TICKS(200));
}
dir.close();
}

View File

@@ -60,28 +60,35 @@ void UploadManager::processPendingUploads() {
File dir = SD.open(path);
if (!dir || !dir.isDirectory()) {
if(dir) dir.close();
vTaskDelay(1); // yield do IDLE0 między katalogami
continue;
}
for (File f = dir.openNextFile(); f; f = dir.openNextFile()) {
vTaskDelay(1); // yield do IDLE0 przy każdym pliku — zapobiega głodzeniu WDT
if (f.isDirectory()) { f.close(); continue; }
String childPath = String(f.name());
if (!childPath.startsWith("/")) {
childPath = path + "/" + childPath;
}
if (childPath.endsWith(".wmt")) {
if (childPath == capture_.getCurrentCapturePath()) continue;
ESP_LOGI(TAG_UPLOAD, "Found pending file: %s", childPath.c_str());
uploadFile(childPath);
delay(1000);
}
f.close();
// Pomijamy pliki .upl (już wgrane) i inne rozszerzenia
if (!childPath.endsWith(".wmt")) continue;
// Pomijamy plik aktualnie zapisywany przez pomiar
if (childPath == capture_.getCurrentCapturePath()) continue;
Watchdog::feed();
if (WiFi.status() != WL_CONNECTED) {
dir.close();
return;
}
ESP_LOGI(TAG_UPLOAD, "Found pending file: %s", childPath.c_str());
uploadFile(childPath);
// Krótka przerwa po uploaderze — pozwala IDLE0 na reset WDT
vTaskDelay(pdMS_TO_TICKS(200));
}
dir.close();
}