diff --git a/src/ens/storage.c b/src/ens/storage.c index 4ecf8fa..834af67 100644 --- a/src/ens/storage.c +++ b/src/ens/storage.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,8 @@ static struct nvs_fs info_fs; +static ens_fs_t ens_fs; + // Information about currently stored contacts static stored_contacts_information_t contact_information = {.oldest_contact = 0, .count = 0}; @@ -73,6 +76,7 @@ int init_contact_storage(void) { if (rc) { // Error during retrieval of page information + printk("Cannot retrieve page information (err %d)\n", rc); return rc; } info_fs.sector_size = info.size; @@ -81,15 +85,24 @@ int init_contact_storage(void) { rc = nvs_init(&info_fs, DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL); if (rc) { // Error during nvs_init + printk("Cannot init NVS (err %d)\n", rc); return rc; } // Load the current storage information rc = load_storage_information(); + if (rc) { + printk("Cannot load storage information (err %d)\n", rc); + return rc; + } printk("Currently %d contacts stored!\n", contact_information.count); printk("Space available: %d\n", FLASH_AREA_SIZE(storage)); + rc = ens_fs_init(&ens_fs, FLASH_AREA_ID(ens_storage), 32); + if(rc) { + printk("Cannot init ens_fs (err %d)\n", rc); + } return rc; } diff --git a/zephyr/prj.conf b/zephyr/prj.conf index 8be03c2..e157463 100644 --- a/zephyr/prj.conf +++ b/zephyr/prj.conf @@ -23,6 +23,7 @@ CONFIG_NVS=y CONFIG_NVS_LOG_LEVEL_DBG=y CONFIG_MPU_ALLOW_FLASH_WRITE=y + # CONFIG_DISK_ACCESS=y CONFIG_MAIN_STACK_SIZE=2048