diff --git a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp index fe5c272925..ee991476dc 100644 --- a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp +++ b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/can.hpp @@ -95,7 +95,6 @@ class CanIface : public uavcan::ICanIface, uavcan::Noncopyable enum { NumFilters = 14 }; static const uavcan::uint32_t TSR_ABRQx[NumTxMailboxes]; - static const uavcan::uint32_t TSR_TERRx[NumTxMailboxes]; RxQueue rx_queue_; bxcan::CanType* const can_; diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index 8bb7784db8..7320497ed0 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -170,13 +170,6 @@ const uavcan::uint32_t CanIface::TSR_ABRQx[CanIface::NumTxMailboxes] = bxcan::TSR_ABRQ2 }; -const uavcan::uint32_t CanIface::TSR_TERRx[CanIface::NumTxMailboxes] = -{ - bxcan::TSR_TERR0, - bxcan::TSR_TERR1, - bxcan::TSR_TERR2 -}; - int CanIface::computeTimings(const uavcan::uint32_t target_bitrate, Timings& out_timings) { /* @@ -574,30 +567,23 @@ void CanIface::handleStatusChangeInterrupt() { can_->MSR = bxcan::MSR_ERRI; // Clear error - /* - * General error counter - */ const uavcan::uint8_t lec = uavcan::uint8_t((can_->ESR & bxcan::ESR_LEC_MASK) >> bxcan::ESR_LEC_SHIFT); if (lec != 0) { last_hw_error_code_ = lec; can_->ESR = 0; error_cnt_++; - } - /* - * Serving abort requests - */ - for (int i = 0; i < NumTxMailboxes; i++) // Dear compiler, may I suggest you to unroll this loop please. - { - TxItem& txi = pending_tx_[i]; - if ((can_->TSR & TSR_TERRx[i]) != 0 && - txi.pending && - txi.abort_on_error) + // Serving abort requests + for (int i = 0; i < NumTxMailboxes; i++) // Dear compiler, may I suggest you to unroll this loop please. { - can_->TSR = TSR_ABRQx[i]; - txi.pending = false; - served_aborts_cnt_++; + TxItem& txi = pending_tx_[i]; + if (txi.pending && txi.abort_on_error) + { + can_->TSR = TSR_ABRQx[i]; + txi.pending = false; + served_aborts_cnt_++; + } } } }