net_buf_simple_add_u8(msg1,c); // <------------------------------------------------------- C is 0 or 1 net_buf_simple_add_u8(msg1, 00); //<-------------------------------------------------------- what to send from here ??
// If I didn't add this then firmware throws error after receiving message.
if (bt_mesh_model_send(&root_models[2], &ctx1, msg1, NULL, NULL)) { printk("Unable to send Vendor Button message\n\r"); }
printk("Button message sent with OpCode 0x%08x......\n\r", BT_MESH_MODEL_OP_2(0x82, 0x03));
}
I am calling this function from Button interrupt to publish data as '1' or '0' to all nodes which are part
one particular group. But success rate is not impressive at all.
I'm able to see printk("Button message sent with OpCode 0x%08x......\n\r", BT_MESH_MODEL_OP_2(0x82, 0x03)) on
serial terminal of Publisher on each click of button. That means foo() is executing.
But on an average only 6 out 10 times, exact data get received by all Subscribers.
Silicon Labs Bluetooth Mesh App has functionality of Master Control (on/off switch which control LED on all nodes in single click).
It is working perfectly. Success rate is 100%.
But if I try the same with (Publisher) node based on Zephyr as mentioned above then it is not 100% reliable.