mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-12 02:44:00 -04:00
HAL_SITL: make cork/push safe to call nested
This commit is contained in:
parent
351304ebcb
commit
f257a869ac
@ -69,14 +69,18 @@ void RCOutput::read(uint16_t* period_us, uint8_t len)
|
|||||||
|
|
||||||
void RCOutput::cork(void)
|
void RCOutput::cork(void)
|
||||||
{
|
{
|
||||||
memcpy(_pending, _sitlState->pwm_output, SITL_NUM_CHANNELS * sizeof(uint16_t));
|
if (!_corked) {
|
||||||
_corked = true;
|
memcpy(_pending, _sitlState->pwm_output, SITL_NUM_CHANNELS * sizeof(uint16_t));
|
||||||
|
_corked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RCOutput::push(void)
|
void RCOutput::push(void)
|
||||||
{
|
{
|
||||||
memcpy(_sitlState->pwm_output, _pending, SITL_NUM_CHANNELS * sizeof(uint16_t));
|
if (_corked) {
|
||||||
_corked = false;
|
memcpy(_sitlState->pwm_output, _pending, SITL_NUM_CHANNELS * sizeof(uint16_t));
|
||||||
|
_corked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user