Compare commits

..

No commits in common. "f9c8434529e4b75db5061dfbe0bad1b1de0fb7c1" and "a3bc029700055cca56f678bf1ad9f71456b8afb2" have entirely different histories.

3 changed files with 5 additions and 6 deletions

View File

@ -328,14 +328,14 @@ void listDir(const char *dirname, uint8_t levels, bool del)
void rmDir(const char *dirname) void rmDir(const char *dirname)
{ {
#ifdef FSCom #ifdef FSCom
spiLock->lock();
#if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) #if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
listDir(dirname, 10, true); listDir(dirname, 10, true);
#elif defined(ARCH_NRF52) #elif defined(ARCH_NRF52)
// nRF52 implementation of LittleFS has a recursive delete function // nRF52 implementation of LittleFS has a recursive delete function
FSCom.rmdir_r(dirname); FSCom.rmdir_r(dirname);
#endif #endif
spiLock->unlock();
#endif #endif
} }

View File

@ -361,8 +361,6 @@ void setup()
#endif #endif
#endif #endif
initSPI();
OSThread::setup(); OSThread::setup();
ledPeriodic = new Periodic("Blink", ledBlinker); ledPeriodic = new Periodic("Blink", ledBlinker);
@ -647,6 +645,8 @@ void setup()
rp2040Setup(); rp2040Setup();
#endif #endif
initSPI(); // needed here before reading from littleFS
// We do this as early as possible because this loads preferences from flash // We do this as early as possible because this loads preferences from flash
// but we need to do this after main cpu init (esp32setup), because we need the random seed set // but we need to do this after main cpu init (esp32setup), because we need the random seed set
nodeDB = new NodeDB; nodeDB = new NodeDB;

View File

@ -352,9 +352,8 @@ bool NodeDB::factoryReset(bool eraseBleBonds)
{ {
LOG_INFO("Perform factory reset!"); LOG_INFO("Perform factory reset!");
// first, remove the "/prefs" (this removes most prefs) // first, remove the "/prefs" (this removes most prefs)
spiLock->lock();
rmDir("/prefs"); // this uses spilock internally... rmDir("/prefs"); // this uses spilock internally...
spiLock->lock();
#ifdef FSCom #ifdef FSCom
if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) { if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) {
LOG_ERROR("Could not remove rangetest.csv file"); LOG_ERROR("Could not remove rangetest.csv file");