if i use this code to send data,i sometimes miss data..
do
{
err_code = ble_nus_string_send(&m_nus, (uint8_t*)data, &data_len);
if (( err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY))
{
APP_ERROR_CHECK(err_code);
}
} while (err_code == NRF_ERROR_BUSY);
but if i use this way, data can be sent sucessfully .
loop:
err_code = ble_nus_string_send(&m_nus, (uint8_t*)data, &data_len);
nrf_delay_ms(1);
if(err_code!=0)
goto loop;
why ? maybe only error is busy, it will send again, if other error,it would not ?
it would not, so if we face other error,it will lose data ...