From 1bbfdf1d1ada373cdd5847272f2726d083468f01 Mon Sep 17 00:00:00 2001 From: Vikrant More Date: Fri, 15 Jun 2018 17:19:42 +0530 Subject: [PATCH] samples: mesh/onoff-app: Enable persistent storage support Enable persistent storage support in samples/boards/nrf52/mesh/onoff-app. Signed-off-by: Vikrant More --- samples/boards/nrf52/mesh/onoff-app/README.rst | 4 +--- samples/boards/nrf52/mesh/onoff-app/prj.conf | 9 +++++++++ samples/boards/nrf52/mesh/onoff-app/src/main.c | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/boards/nrf52/mesh/onoff-app/README.rst b/samples/boards/nrf52/mesh/onoff-app/README.rst index 4a32d07ae6f..292759977dd 100644 --- a/samples/boards/nrf52/mesh/onoff-app/README.rst +++ b/samples/boards/nrf52/mesh/onoff-app/README.rst @@ -85,9 +85,7 @@ root element's unicast address as it is the only one that has a configuration server model. If meshctl is gracefully exited, it can be restarted and reconnected to -network 0x0. The board configuration is volatile and if the board is reset, -power cycled, or reprogrammed, it will have to be provisioned and configured -again. +network 0x0. The meshctl utility also supports a onoff model client that can be used to change the state of any LED that is bound to application key 0x1. diff --git a/samples/boards/nrf52/mesh/onoff-app/prj.conf b/samples/boards/nrf52/mesh/onoff-app/prj.conf index 628d830fe4b..175a0f72372 100644 --- a/samples/boards/nrf52/mesh/onoff-app/prj.conf +++ b/samples/boards/nrf52/mesh/onoff-app/prj.conf @@ -2,6 +2,15 @@ CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +CONFIG_BT_SETTINGS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_FCB=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_FCB=y +CONFIG_BT_MESH_RPL_STORE_TIMEOUT=600 + CONFIG_BOOT_BANNER=y CONFIG_BUILD_TIMESTAMP=y diff --git a/samples/boards/nrf52/mesh/onoff-app/src/main.c b/samples/boards/nrf52/mesh/onoff-app/src/main.c index b82b83cdc5b..e161dca4f6c 100644 --- a/samples/boards/nrf52/mesh/onoff-app/src/main.c +++ b/samples/boards/nrf52/mesh/onoff-app/src/main.c @@ -37,6 +37,7 @@ */ #include +#include #include #include #include @@ -590,6 +591,10 @@ static void bt_ready(int err) return; } + if (IS_ENABLED(CONFIG_SETTINGS)) { + settings_load(); + } + bt_mesh_prov_enable(BT_MESH_PROV_GATT | BT_MESH_PROV_ADV); SYS_LOG_INF("Mesh initialized");