AP_Periph: reduce Rx latency by reading while sitting in delay

This commit is contained in:
bugobliterator 2021-07-24 00:18:56 +05:30 committed by Andrew Tridgell
parent e9faab288c
commit bb65ab83be
2 changed files with 7 additions and 3 deletions

View File

@ -395,7 +395,7 @@ void AP_Periph_FW::update()
#endif
can_update();
hal.scheduler->delay(1);
#if (defined(HAL_PERIPH_NEOPIXEL_COUNT_WITHOUT_NOTIFY) && HAL_PERIPH_NEOPIXEL_COUNT_WITHOUT_NOTIFY == 8) || defined(HAL_PERIPH_ENABLE_NOTIFY)
update_rainbow();
#endif

View File

@ -1552,8 +1552,12 @@ void AP_Periph_FW::can_update()
#ifdef HAL_PERIPH_ENABLE_RC_OUT
rcout_update();
#endif
processTx();
processRx();
const uint32_t now_us = AP_HAL::micros();
while ((AP_HAL::micros() - now_us) < 1000) {
hal.scheduler->delay_microseconds(64);
processTx();
processRx();
}
}
/*