Fix in old session delete
This commit is contained in:
parent
fb0b455910
commit
e2f72297e4
|
@ -112,7 +112,7 @@ private:
|
|||
auto freeBytes = portablefs::totalBytes() - portablefs::usedBytes();
|
||||
while (freeBytes < requiredSpace)
|
||||
{
|
||||
uint32_t nextSessionToDelete = 0;
|
||||
uint32_t nextSessionToDelete = uint32_t(-1);
|
||||
|
||||
auto dir = portablefs::openDir(CONFIG_DATA_PATH);
|
||||
String filenameToDelete;
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
{
|
||||
const auto fileName = dir.fileName();
|
||||
const auto fileNameWithoutDir = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
auto sessionId = fileNameWithoutDir.toInt();
|
||||
uint32_t sessionId = fileNameWithoutDir.toInt();
|
||||
if (sessionId < nextSessionToDelete)
|
||||
{
|
||||
nextSessionToDelete = sessionId;
|
||||
|
@ -131,6 +131,7 @@ private:
|
|||
}
|
||||
}
|
||||
assert(nextSessionToDelete > 0);
|
||||
assert(nextSessionToDelete < uint32_t(-1));
|
||||
Serial.printf("Removing old session %s to make space\n", filenameToDelete.c_str());
|
||||
portablefs::remove(filenameToDelete.c_str());
|
||||
auto newFreeBytes = portablefs::totalBytes() - portablefs::usedBytes();
|
||||
|
|
Loading…
Reference in New Issue