1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/lorawan: fix potential hang in example

This commit is contained in:
Alexandre Abadie 2019-01-30 10:05:37 +01:00
parent f6e616d48f
commit bb8bdadd69
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -67,9 +67,15 @@ static void _prepare_next_alarm(void)
static void _send_message(void)
{
printf("Sending: %s\n", message);
/* The send call blocks until done */
semtech_loramac_send(&loramac, (uint8_t *)message, strlen(message));
/* Wait until the send cycle has completed */
/* Try to send the message */
uint8_t ret = semtech_loramac_send(&loramac,
(uint8_t *)message, strlen(message));
if (ret != SEMTECH_LORAMAC_TX_OK) {
printf("Cannot send message '%s', ret code: %d\n", message, ret);
return;
}
/* The send was successfully scheduled, now wait until the send cycle has
completed and a reply is received from the MAC */
semtech_loramac_recv(&loramac);
}