mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-17 00:54:20 +00:00
flash cleaning improvements
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
LOG_MODULE_REGISTER(zephcore_observer_main, CONFIG_ZEPHCORE_MAIN_LOG_LEVEL);
|
||||
|
||||
#include <app/RepeaterDataStore.h>
|
||||
#include "../adapters/datastore/ZephyrFsFormat.h"
|
||||
#include <app/ObserverMesh.h>
|
||||
#include <adapters/clock/ZephyrRTCClock.h>
|
||||
#include <mesh/RadioIncludes.h>
|
||||
@@ -306,6 +307,24 @@ int main(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* First boot on a volume that is not this role's - a fresh chip, a
|
||||
* companion, or a node that was running Arduino MeshCore, whose nRF52
|
||||
* filesystems overlap our lfs_partition
|
||||
* (devdocs/HANDOVER_lfs_arduino_overlap.md). Erase everything so we
|
||||
* start from a known state: Zephyr's automount only
|
||||
* auto-formats the LittleFS volume when it fails to mount, and never
|
||||
* touches storage_partition (BLE bonds NVS) or QSPI.
|
||||
*
|
||||
* Self-limiting, so it needs no "done" marker: the identity is generated
|
||||
* and saved a few lines below, and loadPrefs() persists defaults on the
|
||||
* same boot, so the next boot sees this role's data and skips this. */
|
||||
if (!data_store.hasRoleData()) {
|
||||
LOG_WRN("Volume holds no data for this role - formatting before first boot");
|
||||
if (!zephcore_fs_format_all(nullptr)) {
|
||||
LOG_ERR("First-boot format failed - /lfs is not mounted");
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize LittleFS data store */
|
||||
if (!data_store.begin()) {
|
||||
LOG_ERR("RepeaterDataStore init failed");
|
||||
|
||||
Reference in New Issue
Block a user