Browse Source

HAL_SITL: fixed startup of SITL in synthetic clock mode

mission-4.1.18
Andrew Tridgell 10 years ago
parent
commit
74581a55bc
  1. 2
      libraries/AP_HAL_AVR_SITL/SITL_State.cpp
  2. 6
      libraries/AP_HAL_AVR_SITL/Scheduler.cpp

2
libraries/AP_HAL_AVR_SITL/SITL_State.cpp

@ -215,7 +215,7 @@ void SITL_State::_sitl_setup(void) @@ -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

6
libraries/AP_HAL_AVR_SITL/Scheduler.cpp

@ -317,6 +317,12 @@ void SITLScheduler::panic(const prog_char_t *errormsg) { @@ -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

Loading…
Cancel
Save