This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Mesh for more than one models

Hi, 

I am using nRF52832 to design a mesh system,  starting with light.

Everything is fine, and development is reaching the end.  

Before today, I use only one model,  modified on Simple_On_Off, with multi states to control light from cellphone , everything works fine. Now I am try to add two more models,

say total three models,defined as:

static simple_on_off_client_t     m_clients[CLIENT_MODEL_INSTANCE_COUNT];
static light_lightness_client_t     L_lightness_clients[CLIENT_MODEL_INSTANCE_COUNT];
static light_hsl_client_t               L_hsl_clients[CLIENT_MODEL_INSTANCE_COUNT];

Increased MODEL INSTANCE COUNT IN "light_switch_example_common"

/** Number of On-Off client models on the Switch Node */
#define CLIENT_MODEL_INSTANCE_COUNT (6)

/** Number of group address being used in this example */
#define GROUP_ADDR_COUNT (4)

Add and initiate models here:

static void models_init_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");

for (uint32_t i = 0; i < CLIENT_MODEL_INSTANCE_COUNT; ++i)
{
m_clients[i].status_cb = on_off_client_status_cb;
m_clients[i].timeout_cb = on_off_client_publish_timeout_cb;
L_lightness_clients[i].status_cb = lightness_client_status_cb;
L_lightness_clients[i].timeout_cb = lightness_client_publish_timeout_cb;
L_hsl_clients[i].status_cb = hsl_client_status_cb;
L_hsl_clients[i].timeout_cb = hsl_client_publish_timeout_cb;

ERROR_CHECK(simple_on_off_client_init(&m_clients[i], i + 1));
ERROR_CHECK(light_lightness_client_init(&L_lightness_clients[i], i + 1));
ERROR_CHECK(light_hsl_client_init(&L_hsl_clients[i], i + 1));

ERROR_CHECK(access_model_subscription_list_alloc(m_clients[i].model_handle));
ERROR_CHECK(access_model_subscription_list_alloc(L_lightness_clients[i].model_handle));
ERROR_CHECK(access_model_subscription_list_alloc(L_hsl_clients[i].model_handle));
}
}

compiled fine,  but  when debug, Mesh Error 4   comes from model add.

<t: 0>, main.c, 419, ----- BLE Mesh Light Switch Client Demo -----
<t: 535>, main.c, 320, Initializing and adding models
<t: 541>, app_error_weak.c, 105, Mesh error 4 at 0x000267B9 (G:\Light_Bulb_Project\mesh_bulb_211\examples\light_switch\proxy_client\src\main.c:333)

I really do not understand which step(s) is missed ,  

Please help, very urgent.

Brent

Related