mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-01 02:09:57 +00:00
Fix NRF52 default append write mode of files (#5858)
* Fix NRF52 default append write mode of files * Inside the lock
This commit is contained in:
parent
fb2c008c89
commit
85de193845
@ -9,7 +9,9 @@ static File openFile(const char *filename, bool fullAtomic)
|
||||
LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic);
|
||||
#ifdef ARCH_NRF52
|
||||
lfs_assert_failed = false;
|
||||
return FSCom.open(filename, FILE_O_WRITE);
|
||||
File file = FSCom.open(filename, FILE_O_WRITE);
|
||||
file.seek(0);
|
||||
return file;
|
||||
#endif
|
||||
if (!fullAtomic)
|
||||
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
|
||||
@ -59,6 +61,9 @@ bool SafeFile::close()
|
||||
return false;
|
||||
|
||||
spiLock->lock();
|
||||
#ifdef ARCH_NRF52
|
||||
f.truncate();
|
||||
#endif
|
||||
f.close();
|
||||
spiLock->unlock();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user