From cdd8bfc5c39d1a5b135eedc3f164cdf179fa07d3 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 7 Jul 2015 19:20:05 +0300 Subject: [PATCH] STM32: doc comment, fixed error counting --- libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp | 1 + libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp index ee991476dc..e58e5775e9 100644 --- a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp +++ b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp @@ -168,6 +168,7 @@ public: /** * Number of times the driver exercised library's requirement to abort transmission on first error. + * This is an atomic read, it doesn't require a critical section. * See @ref uavcan::CanIOFlagAbortOnError. */ uavcan::uint32_t getVoluntaryTxAbortCount() const { return served_aborts_cnt_; } diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index 7320497ed0..aa8c9c532f 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -467,14 +467,12 @@ void CanIface::handleTxMailboxInterrupt(uavcan::uint8_t mailbox_index, bool txok had_activity_ = had_activity_ || txok; TxItem& txi = pending_tx_[mailbox_index]; + if (txi.loopback && txok && txi.pending) { rx_queue_.push(txi.frame, utc_usec, uavcan::CanIOFlagLoopback); } - if (!txok) - { - error_cnt_++; - } + txi.pending = false; }