mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-09 11:55:46 +00:00
migrate to NVS, update formatters
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "RepeaterDataStore.h"
|
||||
#include <zephyr/fs/fs.h>
|
||||
#include <zephyr/storage/flash_map.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -354,6 +355,17 @@ bool RepeaterDataStore::formatFileSystem() {
|
||||
}
|
||||
fs_closedir(&dir);
|
||||
|
||||
#if FIXED_PARTITION_EXISTS(storage_partition)
|
||||
/* Erase the NVS bonds partition too — a factory reset should clear BLE
|
||||
* bonds, not just repeater files. Caller reboots so NVS re-inits clean. */
|
||||
const struct flash_area *fap;
|
||||
if (flash_area_open(PARTITION_ID(storage_partition), &fap) == 0) {
|
||||
LOG_INF("Formatting NVS storage (%u bytes)", (unsigned)fap->fa_size);
|
||||
flash_area_flatten(fap, 0, fap->fa_size);
|
||||
flash_area_close(fap);
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG_INF("Repeater data erased");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user