From f9c8434529e4b75db5061dfbe0bad1b1de0fb7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 17 Dec 2024 21:17:20 +0100 Subject: [PATCH] don't double lock --- src/FSCommon.cpp | 4 ++-- src/mesh/NodeDB.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 3fc4717a0..9ffd183f4 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -328,14 +328,14 @@ void listDir(const char *dirname, uint8_t levels, bool del) void rmDir(const char *dirname) { #ifdef FSCom - spiLock->lock(); + #if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) listDir(dirname, 10, true); #elif defined(ARCH_NRF52) // nRF52 implementation of LittleFS has a recursive delete function FSCom.rmdir_r(dirname); #endif - spiLock->unlock(); + #endif } diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 187fe3ab0..8b4f4f504 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -352,8 +352,9 @@ bool NodeDB::factoryReset(bool eraseBleBonds) { LOG_INFO("Perform factory reset!"); // first, remove the "/prefs" (this removes most prefs) - rmDir("/prefs"); // this uses spilock internally... spiLock->lock(); + rmDir("/prefs"); // this uses spilock internally... + #ifdef FSCom if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) { LOG_ERROR("Could not remove rangetest.csv file");