HAL_ChibiOS: allow HAL_Semaphore in the bootloader

This commit is contained in:
Andrew Tridgell 2024-01-13 16:29:47 +11:00
parent 4289a4bb3a
commit 654b70da67

View File

@ -53,6 +53,9 @@ bool Semaphore::take(uint32_t timeout_ms)
if (take_nonblocking()) { if (take_nonblocking()) {
return true; return true;
} }
#ifdef HAL_BOOTLOADER_BUILD
return false;
#else
uint64_t start = AP_HAL::micros64(); uint64_t start = AP_HAL::micros64();
do { do {
hal.scheduler->delay_microseconds(200); hal.scheduler->delay_microseconds(200);
@ -61,6 +64,7 @@ bool Semaphore::take(uint32_t timeout_ms)
} }
} while ((AP_HAL::micros64() - start) < timeout_ms*1000); } while ((AP_HAL::micros64() - start) < timeout_ms*1000);
return false; return false;
#endif
} }
bool Semaphore::take_nonblocking() bool Semaphore::take_nonblocking()