|
|
|
@ -291,6 +291,16 @@ int32_t SdVolume::freeClusterCount() {
|
|
|
|
|
for (uint16_t i = 0; i < n; i++)
|
|
|
|
|
if (cacheBuffer_.fat32[i] == 0) free++;
|
|
|
|
|
}
|
|
|
|
|
#ifdef ESP32
|
|
|
|
|
// Needed to reset the idle task watchdog timer on ESP32 as reading the complete FAT may easily
|
|
|
|
|
// block for 10+ seconds. yield() is insufficient since it blocks lower prio tasks (e.g., idle).
|
|
|
|
|
static millis_t nextTaskTime = 0;
|
|
|
|
|
const millis_t ms = millis();
|
|
|
|
|
if (ELAPSED(ms, nextTaskTime) {
|
|
|
|
|
vTaskDelay(1); // delay 1 tick (Minimum. Usually 10 or 1 ms depending on skdconfig.h)
|
|
|
|
|
nextTaskTime = ms + 1000; // tickle the task manager again in 1 second
|
|
|
|
|
}
|
|
|
|
|
#endif // ESP32
|
|
|
|
|
}
|
|
|
|
|
return free;
|
|
|
|
|
}
|
|
|
|
|