Browse Source

HAL_SITL: make cork/push safe to call nested

mission-4.1.18
Andrew Tridgell 8 years ago
parent
commit
f257a869ac
  1. 12
      libraries/AP_HAL_SITL/RCOutput.cpp

12
libraries/AP_HAL_SITL/RCOutput.cpp

@ -69,14 +69,18 @@ void RCOutput::read(uint16_t* period_us, uint8_t len) @@ -69,14 +69,18 @@ void RCOutput::read(uint16_t* period_us, uint8_t len)
void RCOutput::cork(void)
{
memcpy(_pending, _sitlState->pwm_output, SITL_NUM_CHANNELS * sizeof(uint16_t));
_corked = true;
if (!_corked) {
memcpy(_pending, _sitlState->pwm_output, SITL_NUM_CHANNELS * sizeof(uint16_t));
_corked = true;
}
}
void RCOutput::push(void)
{
memcpy(_sitlState->pwm_output, _pending, SITL_NUM_CHANNELS * sizeof(uint16_t));
_corked = false;
if (_corked) {
memcpy(_sitlState->pwm_output, _pending, SITL_NUM_CHANNELS * sizeof(uint16_t));
_corked = false;
}
}
#endif

Loading…
Cancel
Save