NRF52 - Remove file totally before opening write (#5916)

* Remove prefs first

* Remove file first

* Remove truncate

* No longer needed

* Missed a param

* That wasn't supposed to be there

* Remove vestigal lfs assert

* Durr
This commit is contained in:
Ben Meadors 2025-01-23 19:12:20 -06:00 committed by GitHub
parent 3b40fe9805
commit 0d860882a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,9 +8,8 @@ static File openFile(const char *filename, bool fullAtomic)
concurrency::LockGuard g(spiLock);
LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic);
#ifdef ARCH_NRF52
File file = FSCom.open(filename, FILE_O_WRITE);
file.seek(0);
return file;
FSCom.remove(filename);
return FSCom.open(filename, FILE_O_WRITE);
#endif
if (!fullAtomic)
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
@ -59,9 +58,6 @@ bool SafeFile::close()
return false;
spiLock->lock();
#ifdef ARCH_NRF52
f.truncate();
#endif
f.close();
spiLock->unlock();