diff --git a/libraries/AP_HAL_VRBRAIN/Scheduler.cpp b/libraries/AP_HAL_VRBRAIN/Scheduler.cpp index c86201a670..c9df6edd36 100644 --- a/libraries/AP_HAL_VRBRAIN/Scheduler.cpp +++ b/libraries/AP_HAL_VRBRAIN/Scheduler.cpp @@ -138,7 +138,7 @@ void VRBRAINScheduler::delay_microseconds_boost(uint16_t usec) void VRBRAINScheduler::delay(uint16_t ms) { - if (in_timerprocess()) { + if (!in_main_thread()) { ::printf("ERROR: delay() from timer process\n"); return; } @@ -375,6 +375,11 @@ bool VRBRAINScheduler::in_timerprocess() return getpid() != _main_task_pid; } +bool VRBRAINScheduler::in_main_thread() +{ + return getpid() == _main_task_pid; +} + void VRBRAINScheduler::system_initialized() { if (_initialized) { AP_HAL::panic("PANIC: scheduler::system_initialized called"