1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

conn_can_raw: fix xtimer removal

This commit is contained in:
Vincent Dupont 2017-10-11 09:51:28 +02:00
parent a82930cf60
commit d251456585

View File

@ -153,12 +153,11 @@ int conn_can_raw_send(conn_can_raw_t *conn, const struct can_frame *frame, int f
int timeout = 5;
while (1) {
mbox_get(&conn->mbox, &msg);
xtimer_remove(&timer);
switch (msg.type) {
case CAN_MSG_TX_ERROR:
xtimer_remove(&timer);
return -EIO;
case CAN_MSG_TX_CONFIRMATION:
xtimer_remove(&timer);
if ((int)msg.content.value == handle) {
DEBUG("conn_can_raw_send: frame sent correctly\n");
return 0;
@ -170,6 +169,7 @@ int conn_can_raw_send(conn_can_raw_t *conn, const struct can_frame *frame, int f
break;
case _TIMEOUT_TX_MSG_TYPE:
DEBUG("conn_can_raw_send: timeout\n");
raw_can_abort(conn->ifnum, handle);
return -ETIMEDOUT;
break;
default:
@ -178,6 +178,7 @@ int conn_can_raw_send(conn_can_raw_t *conn, const struct can_frame *frame, int f
if (!timeout--) {
return -EINTR;
}
xtimer_set(&timer, CONN_CAN_RAW_TIMEOUT_TX_CONF);
break;
}
}