SRV_Channel: added set_disabled_channel_mask()

used by AP_BLHeli
This commit is contained in:
Andrew Tridgell 2018-04-01 16:01:37 +10:00
parent ef539d4145
commit 0018e1f944
3 changed files with 8 additions and 1 deletions

View File

@ -422,6 +422,9 @@ public:
static void push();
// disable output to a set of channels given by a mask. This is used by the AP_BLHeli code
static void set_disabled_channel_mask(uint16_t mask) { disabled_mask = mask; }
private:
struct {
bool k_throttle_reversible:1;
@ -449,6 +452,7 @@ private:
// support for BLHeli protocol
AP_BLHeli blheli;
static AP_BLHeli *blheli_ptr;
static uint16_t disabled_mask;
SRV_Channel obj_channels[NUM_SERVO_CHANNELS];

View File

@ -50,7 +50,9 @@ void SRV_Channel::output_ch(void)
}
}
}
hal.rcout->write(ch_num, output_pwm);
if (!(SRV_Channels::disabled_mask & (1U<<ch_num))) {
hal.rcout->write(ch_num, output_pwm);
}
}
/*

View File

@ -29,6 +29,7 @@ SRV_Channels *SRV_Channels::instance;
AP_Volz_Protocol *SRV_Channels::volz_ptr;
AP_SBusOut *SRV_Channels::sbus_ptr;
AP_BLHeli *SRV_Channels::blheli_ptr;
uint16_t SRV_Channels::disabled_mask;
bool SRV_Channels::disabled_passthrough;
bool SRV_Channels::initialised;