mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 22:52:07 +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);
|
LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic);
|
||||||
#ifdef ARCH_NRF52
|
#ifdef ARCH_NRF52
|
||||||
lfs_assert_failed = false;
|
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
|
#endif
|
||||||
if (!fullAtomic)
|
if (!fullAtomic)
|
||||||
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
|
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
|
||||||
@ -59,6 +61,9 @@ bool SafeFile::close()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
spiLock->lock();
|
spiLock->lock();
|
||||||
|
#ifdef ARCH_NRF52
|
||||||
|
f.truncate();
|
||||||
|
#endif
|
||||||
f.close();
|
f.close();
|
||||||
spiLock->unlock();
|
spiLock->unlock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user