diff --git a/libraries/AP_HAL_PX4/Scheduler.cpp b/libraries/AP_HAL_PX4/Scheduler.cpp index 0f41e2f35a..400f9bf018 100644 --- a/libraries/AP_HAL_PX4/Scheduler.cpp +++ b/libraries/AP_HAL_PX4/Scheduler.cpp @@ -172,17 +172,13 @@ void PX4Scheduler::delay_microseconds_boost(uint16_t usec) void PX4Scheduler::delay(uint16_t ms) { - if (!in_main_thread()) { - ::printf("ERROR: delay() from timer process\n"); - return; - } perf_begin(_perf_delay); uint64_t start = AP_HAL::micros64(); while ((AP_HAL::micros64() - start)/1000 < ms && !_px4_thread_should_exit) { delay_microseconds_semaphore(1000); - if (_min_delay_cb_ms <= ms) { + if (in_main_thread() && _min_delay_cb_ms <= ms) { call_delay_cb(); } }