SRV_Channel: don't count disabled channels in mask and setup functions

disable channels that are not in use
This commit is contained in:
Andy Piper 2022-03-25 10:45:43 +00:00 committed by Peter Barker
parent 4fa0e275fd
commit 6511a65b67
2 changed files with 3 additions and 1 deletions

View File

@ -183,7 +183,7 @@ public:
// check if a function is valid for indexing into functions
static bool valid_function(Aux_servo_function_t fn) {
return fn >= 0 && fn < k_nr_aux_servo_functions;
return fn > k_none && fn < k_nr_aux_servo_functions;
}
bool valid_function(void) const {
return valid_function(function);

View File

@ -208,6 +208,8 @@ void SRV_Channels::enable_aux_servos()
// see if it is a valid function
if (c.valid_function()) {
hal.rcout->enable_ch(c.ch_num);
} else {
hal.rcout->disable_ch(c.ch_num);
}
// output some servo functions before we fiddle with the