Plane: Convert SOAR_ENABLE_CH to RCX_OPTION.

This commit is contained in:
Samuel Tabor 2020-07-13 13:06:58 +01:00 committed by Andrew Tridgell
parent 611217f63e
commit 419f7c9998
1 changed files with 15 additions and 0 deletions

View File

@ -1422,6 +1422,21 @@ void Plane::load_parameters(void)
}
}
// Convert SOAR_ENABLE_CH to RCx_OPTION
AP_Int8 soar_enable_ch;
AP_Param::ConversionInfo soar_info = {
Parameters::k_param_g2,
968,
AP_PARAM_INT8,
nullptr
};
if (AP_Param::find_old_parameter(&soar_info, &soar_enable_ch) && soar_enable_ch.get() != 0) {
RC_Channel *soar_ch = rc().channel(soar_enable_ch - 1);
if (soar_ch != nullptr && !soar_ch->option.configured()) {
soar_ch->option.set_and_save((int16_t)RC_Channel::AUX_FUNC::SOARING); // save the new param
}
}
hal.console->printf("load_all took %uus\n", (unsigned)(micros() - before));
}