Browse Source

AP_HAL_SITL: correct disable channel maths

unilaterally write rcoutput to appease the sitl gods
apm_2208
Andy Piper 3 years ago committed by Peter Barker
parent
commit
63229d7eca
  1. 10
      libraries/AP_HAL_SITL/RCOutput.cpp

10
libraries/AP_HAL_SITL/RCOutput.cpp

@ -35,7 +35,7 @@ void RCOutput::enable_ch(uint8_t ch) @@ -35,7 +35,7 @@ void RCOutput::enable_ch(uint8_t ch)
if (!(_enable_mask & (1U << ch))) {
Debug("enable_ch(%u)\n", ch);
}
_enable_mask |= 1U << ch;
_enable_mask |= (1U << ch);
}
void RCOutput::disable_ch(uint8_t ch)
@ -43,13 +43,14 @@ void RCOutput::disable_ch(uint8_t ch) @@ -43,13 +43,14 @@ void RCOutput::disable_ch(uint8_t ch)
if (_enable_mask & (1U << ch)) {
Debug("disable_ch(%u)\n", ch);
}
_enable_mask &= ~1U << ch;
_enable_mask &= ~(1U << ch);
}
void RCOutput::write(uint8_t ch, uint16_t period_us)
{
_sitlState->output_ready = true;
if (ch < SITL_NUM_CHANNELS && (_enable_mask & (1U<<ch))) {
// FIXME: something in sitl is expecting to be able to read and write disabled channels
if (ch < SITL_NUM_CHANNELS /*&& (_enable_mask & (1U<<ch))*/) {
if (_corked) {
_pending[ch] = period_us;
} else {
@ -60,7 +61,8 @@ void RCOutput::write(uint8_t ch, uint16_t period_us) @@ -60,7 +61,8 @@ void RCOutput::write(uint8_t ch, uint16_t period_us)
uint16_t RCOutput::read(uint8_t ch)
{
if (ch < SITL_NUM_CHANNELS) {
// FIXME: something in sitl is expecting to be able to read and write disabled channels
if (ch < SITL_NUM_CHANNELS /*&& (_enable_mask & (1U<<ch))*/) {
return _sitlState->pwm_output[ch];
}
return 0;

Loading…
Cancel
Save