AP_Arming: only check trim on valid channel count

This commit is contained in:
Andrew Tridgell 2018-07-23 07:05:23 +10:00
parent e50f771f19
commit ab71cec7ef
1 changed files with 4 additions and 0 deletions

View File

@ -459,11 +459,15 @@ bool AP_Arming::hardware_safety_check(bool report)
bool AP_Arming::rc_calibration_checks(bool report) bool AP_Arming::rc_calibration_checks(bool report)
{ {
bool check_passed = true; bool check_passed = true;
const uint8_t num_channels = RC_Channels::get_valid_channel_count();
for (uint8_t i = 0; i < NUM_RC_CHANNELS; i++) { for (uint8_t i = 0; i < NUM_RC_CHANNELS; i++) {
const RC_Channel *ch = RC_Channels::rc_channel(i); const RC_Channel *ch = RC_Channels::rc_channel(i);
if (ch == nullptr) { if (ch == nullptr) {
continue; continue;
} }
if (i >= num_channels && !(ch->has_override())) {
continue;
}
const uint16_t trim = ch->get_radio_trim(); const uint16_t trim = ch->get_radio_trim();
if (ch->get_radio_min() > trim) { if (ch->get_radio_min() > trim) {
if (report) { if (report) {