kopia lustrzana https://github.com/meshtastic/firmware
stability: add SPI lock before saving via littleFS
rodzic
2568d4fcd8
commit
a8bd1ee0da
|
@ -642,6 +642,8 @@ void setup()
|
|||
rp2040Setup();
|
||||
#endif
|
||||
|
||||
initSPI(); // needed here before reading from littleFS
|
||||
|
||||
// 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
|
||||
nodeDB = new NodeDB;
|
||||
|
@ -705,7 +707,6 @@ void setup()
|
|||
#endif
|
||||
|
||||
// Init our SPI controller (must be before screen and lora)
|
||||
initSPI();
|
||||
#ifdef ARCH_RP2040
|
||||
#ifdef HW_SPI1_DEVICE
|
||||
SPI1.setSCK(LORA_SCK);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#if HAS_WIFI
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#endif
|
||||
#include "SPILock.h"
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#include <Preferences.h>
|
||||
#include <esp_efuse.h>
|
||||
|
@ -870,6 +871,9 @@ void NodeDB::loadFromDisk()
|
|||
bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_t *fields, const void *dest_struct,
|
||||
bool fullAtomic)
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
concurrency::LockGuard g(spiLock);
|
||||
#endif
|
||||
bool okay = false;
|
||||
#ifdef FSCom
|
||||
auto f = SafeFile(filename, fullAtomic);
|
||||
|
|
Ładowanie…
Reference in New Issue