Compare commits

..

No commits in common. "12f0df49a1a5944b548c8f4eed33e93147e07c57" and "f9c8434529e4b75db5061dfbe0bad1b1de0fb7c1" have entirely different histories.

3 changed files with 3 additions and 11 deletions

View File

@ -101,14 +101,12 @@ bool copyFile(const char *from, const char *to)
File f1 = FSCom.open(from, FILE_O_READ);
if (!f1) {
LOG_ERROR("Failed to open source file %s", from);
spiLock->unlock();
return false;
}
File f2 = FSCom.open(to, FILE_O_WRITE);
if (!f2) {
LOG_ERROR("Failed to open destination file %s", to);
spiLock->unlock();
return false;
}
@ -147,9 +145,8 @@ bool renameFile(const char *pathFrom, const char *pathTo)
// take SPI Lock
spiLock->lock();
// rename was fixed for ESP32 IDF LittleFS in April
bool result = FSCom.rename(pathFrom, pathTo);
return FSCom.rename(pathFrom, pathTo);
spiLock->unlock();
return result;
#else
// copyFile does its own locking.
if (copyFile(pathFrom, pathTo) && FSCom.remove(pathFrom)) {

View File

@ -43,7 +43,6 @@ bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count)
if (buf == NULL) {
while (count-- && file->read() != EOF)
;
spiLock->unlock();
return count == 0;
}

View File

@ -213,13 +213,11 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
spiLock->lock();
if (!FSBegin()) {
LOG_DEBUG("An Error has occurred while mounting the filesystem");
spiLock->unlock();
return 0;
}
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write");
spiLock->unlock();
return 0;
}
@ -232,7 +230,6 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
if (!fileToWrite) {
LOG_ERROR("There was an error opening the file for writing");
spiLock->unlock();
return 0;
}
@ -252,7 +249,6 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
if (!fileToAppend) {
LOG_ERROR("There was an error opening the file for appending");
spiLock->unlock();
return 0;
}