Commit f78599fb authored by Vikrant More's avatar Vikrant More Committed by Johan Hedberg
Browse files

samples: mesh: sync the init procedure to initialise the mesh



Synchronising the init procedure to initialise the mesh
state only after the settings have been loaded.

Signed-off-by: default avatarVikrant More <vikrant8051@gmail.com>
parent 35f14bc3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -197,11 +197,14 @@ void main(void)
	ps_settings_init();

	/* Initialize the Bluetooth Subsystem */
	err = bt_enable(bt_ready);
	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return;
	}

	bt_ready();

	light_default_status_init();

	update_light_state();
+2 −6
Original line number Diff line number Diff line
@@ -51,15 +51,11 @@ static const struct bt_mesh_prov prov = {
	.reset = prov_reset,
};

void bt_ready(int err)
void bt_ready(void)
{
	int err;
	struct bt_le_oob oob;

	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return;
	}

	printk("Bluetooth initialized\n");

	err = bt_mesh_init(&prov, &comp);
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_STATUS	BT_MESH_MODEL_OP_2(0x82, 0x66)
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_STATUS	BT_MESH_MODEL_OP_2(0x82, 0x68)

void bt_ready(int err);
void bt_ready(void);

#endif