From 2200dfefdb1142974759f3af938e3bbd4b18f5bb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Apr 2020 18:07:39 +1000 Subject: [PATCH] HAL_ChibiOS: during setup() we expect delays this may fix occasional internal errors on SPI during startup --- libraries/AP_HAL_ChibiOS/Scheduler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/Scheduler.cpp b/libraries/AP_HAL_ChibiOS/Scheduler.cpp index 7449a7179f..1c06de7849 100644 --- a/libraries/AP_HAL_ChibiOS/Scheduler.cpp +++ b/libraries/AP_HAL_ChibiOS/Scheduler.cpp @@ -333,6 +333,10 @@ void Scheduler::_timer_thread(void *arg) */ bool Scheduler::in_expected_delay(void) const { + if (!_initialized) { + // until setup() is complete we expect delays + return true; + } if (expect_delay_start != 0) { uint32_t now = AP_HAL::millis(); if (now - expect_delay_start <= expect_delay_length) {