HAL_SITL: fixed startup of SITL in synthetic clock mode

This commit is contained in:
Andrew Tridgell 2015-04-30 17:15:40 +10:00
parent 8a6fc0ad77
commit 74581a55bc
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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