Hi,
when sending small 11 byte messages on the mesh nrf52840 S140 mesh 3.1 Only every 3rd message return status 0, the rest returns status "Device is busy". I know this has something to do with the speed and frequency I transmit the message. When I do this manually i.e with a button it works 100%
how would one use "NRF_MESH_EVT_TX_COMPLETE" in mesh.3.1 it seems to be "true" all the time.
I have tried a few checks to prevent the system from sending another message while still busy but cant seem to come right.
if (m_device_provisioned)
const nrf_mesh_evt_t * p_evt;
if(p_evt->type == NRF_MESH_EVT_TX_COMPLETE){message_sent=true;}
{
if (message_sent==1){
send_message();
}
}
void send_message(void)
{
static bool message_sent=false;
access_message_tx_t msg;
length= sizeof(combined_UUID_result);//SEGGER_RTT_Read(0,buffer, sizeof(buffer));
if (length)
{
msg.opcode.opcode =simple_message_OPCODE_SEND;
msg.opcode.company_id = 0x0059; // Nordic's company ID
msg.p_buffer = (const uint8_t *) &combined_UUID_result[0];
msg.length =length;
status= access_model_publish(m_clients[0].model_handle, &msg);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Status : %u \n", status); // prints the satatus condition
__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS, LOG_LEVEL_DBG1, LOG_CALLBACK_DEFAULT) ; // prints what gets transmitted
// hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
if (status == NRF_ERROR_INVALID_STATE ||
status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Cannot send. Device is busy.\n");
}
else
{
ERROR_CHECK(status);
}
}
}