diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 72282ae388..1d11bf6811 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -997,6 +997,14 @@ RC_Channel::aux_switch_pos_t RC_Channel::get_aux_switch_pos() const return position; } +// return switch position value as LOW, MIDDLE, HIGH +// if reading the switch fails then it returns LOW +RC_Channel::aux_switch_pos_t RC_Channels::get_channel_pos(const uint8_t rcmapchan) const +{ + const RC_Channel* chan = rc().channel(rcmapchan-1); + return chan != nullptr ? chan->get_aux_switch_pos() : RC_Channel::aux_switch_pos_t::LOW; +} + RC_Channel *RC_Channels::find_channel_for_option(const RC_Channel::aux_func_t option) { for (uint8_t i=0; i