forked from Akcelerometry_drgania_WMT/PI_mikrokontroler
Fix IDLE0 starvation with vTaskDelay(1)
This commit is contained in:
@@ -60,28 +60,35 @@ void UploadManager::processPendingUploads() {
|
|||||||
File dir = SD.open(path);
|
File dir = SD.open(path);
|
||||||
if (!dir || !dir.isDirectory()) {
|
if (!dir || !dir.isDirectory()) {
|
||||||
if(dir) dir.close();
|
if(dir) dir.close();
|
||||||
|
vTaskDelay(1); // yield do IDLE0 między katalogami
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File f = dir.openNextFile(); f; f = dir.openNextFile()) {
|
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; }
|
if (f.isDirectory()) { f.close(); continue; }
|
||||||
String childPath = String(f.name());
|
String childPath = String(f.name());
|
||||||
if (!childPath.startsWith("/")) {
|
if (!childPath.startsWith("/")) {
|
||||||
childPath = path + "/" + childPath;
|
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();
|
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();
|
Watchdog::feed();
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
dir.close();
|
dir.close();
|
||||||
return;
|
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();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,28 +60,35 @@ void UploadManager::processPendingUploads() {
|
|||||||
File dir = SD.open(path);
|
File dir = SD.open(path);
|
||||||
if (!dir || !dir.isDirectory()) {
|
if (!dir || !dir.isDirectory()) {
|
||||||
if(dir) dir.close();
|
if(dir) dir.close();
|
||||||
|
vTaskDelay(1); // yield do IDLE0 między katalogami
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File f = dir.openNextFile(); f; f = dir.openNextFile()) {
|
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; }
|
if (f.isDirectory()) { f.close(); continue; }
|
||||||
String childPath = String(f.name());
|
String childPath = String(f.name());
|
||||||
if (!childPath.startsWith("/")) {
|
if (!childPath.startsWith("/")) {
|
||||||
childPath = path + "/" + childPath;
|
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();
|
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();
|
Watchdog::feed();
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
dir.close();
|
dir.close();
|
||||||
return;
|
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();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user