AP_Periph: solve a potential case where last_transmit_us can change inside irqs

This commit is contained in:
bugobliterator 2023-11-01 16:04:23 +11:00 committed by Peter Barker
parent fb26bbfc4c
commit ec2e92de30

View File

@ -1136,8 +1136,9 @@ void AP_Periph_FW::processTx(void)
active if it has had a successful transmit in the
last 2 seconds
*/
const auto *stats = _ins.iface->get_statistics();
if (stats == nullptr || now_us - stats->last_transmit_us < 2000000UL) {
volatile const auto *stats = _ins.iface->get_statistics();
uint64_t last_transmit_us = stats->last_transmit_us;
if (stats == nullptr || AP_HAL::micros64() - last_transmit_us < 2000000UL) {
sent = false;
}
} else {