When initializing models from the models_init_cb it's useful to check the current configuration using the mesh config API. However, the returned values are always the default as the configuration is loaded from flash after models_init_cb has been called.
This make the mesh config harder to use for models that should initialize differently depending on stored state.
The following patch moves the mesh_config_load() above models_init_cb() so that the proper configuration data is availble to the models initialization code.
diff --git a/mesh/stack/src/mesh_stack.c b/mesh/stack/src/mesh_stack.c
index c2cb515..f98adb8 100644
--- a/mesh/stack/src/mesh_stack.c
+++ b/mesh/stack/src/mesh_stack.c
@@ -100,15 +100,15 @@ uint32_t mesh_stack_init(const mesh_stack_init_params_t * p_init_params,
return status;
}
+ /* Load configuration, and check if the device has already been provisioned */
+ mesh_config_load();
+
/* Give application opportunity to initialize application specific models */
if (p_init_params->models.models_init_cb != NULL)
{
p_init_params->models.models_init_cb();
}
- /* Load configuration, and check if the device has already been provisioned */
- mesh_config_load();
-
(void) dsm_flash_config_load();
if (access_flash_config_load())
Using Mesh SDK 3.2.0.
Thanks.