From 0d860882a8012f0fd74b23686d2eefd7d77ac79d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 23 Jan 2025 19:12:20 -0600 Subject: [PATCH] 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 --- src/SafeFile.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index 94232e81d1..c942aa0ee7 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -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();