mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-23 04:45:37 +08:00
[uavcan] correctly check if header and message were put in FIFO buffer (#3536)
This commit is contained in:
@@ -276,13 +276,13 @@ void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature
|
||||
.payload_len = payload_len
|
||||
};
|
||||
|
||||
if(circular_buffer_put(&iface->_tx_fifo, (uint8_t*)&header, sizeof(header))) {
|
||||
if(circular_buffer_put(&iface->_tx_fifo, (uint8_t*)&header, sizeof(header)) < 0) {
|
||||
// fail to post header
|
||||
pprz_mtx_unlock(&iface->tx_fifo_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
if(circular_buffer_put(&iface->_tx_fifo, payload, payload_len)) {
|
||||
if(circular_buffer_put(&iface->_tx_fifo, payload, payload_len) < 0) {
|
||||
// fail to post payload. Remove the header from the fifo
|
||||
circular_buffer_drop(&iface->_tx_fifo);
|
||||
pprz_mtx_unlock(&iface->tx_fifo_mutex);
|
||||
|
||||
Reference in New Issue
Block a user