diff --git a/libraries/AP_HAL_AVR_SITL/SITL_State.cpp b/libraries/AP_HAL_AVR_SITL/SITL_State.cpp index 34ef2aed55..928e40a549 100644 --- a/libraries/AP_HAL_AVR_SITL/SITL_State.cpp +++ b/libraries/AP_HAL_AVR_SITL/SITL_State.cpp @@ -215,7 +215,7 @@ void SITL_State::_sitl_setup(void) if (_synthetic_clock_mode) { // start with non-zero clock - hal.scheduler->stop_clock(100); + hal.scheduler->stop_clock(1); } // setup a pipe used to trigger loop to stop sleeping diff --git a/libraries/AP_HAL_AVR_SITL/Scheduler.cpp b/libraries/AP_HAL_AVR_SITL/Scheduler.cpp index 084d62c242..a8a5a06a69 100644 --- a/libraries/AP_HAL_AVR_SITL/Scheduler.cpp +++ b/libraries/AP_HAL_AVR_SITL/Scheduler.cpp @@ -317,6 +317,12 @@ void SITLScheduler::panic(const prog_char_t *errormsg) { */ void SITLScheduler::stop_clock(uint64_t time_usec) { + if (time_usec == 1) { + // special case for initialisation in synthetic clock mode + stopped_clock_usec = time_usec; + return; + } + if (stopped_clock_usec != 0) { /* wait until the main thread is waiting for us. This ensures