Rover: added automatic parameter upgrade for SRV_Channel

This commit is contained in:
Andrew Tridgell 2017-01-09 12:43:57 +11:00
parent 68504dbcbb
commit 9fe3eba2a0
2 changed files with 13 additions and 3 deletions

View File

@ -594,6 +594,19 @@ void Rover::load_parameters(void)
// Load all auto-loaded EEPROM variables
AP_Param::load_all();
SRV_Channels::set_default_function(CH_1, SRV_Channel::k_steering);
SRV_Channels::set_default_function(CH_3, SRV_Channel::k_throttle);
const uint8_t old_rc_keys[14] = { Parameters::k_param_rc_1_old, Parameters::k_param_rc_2_old,
Parameters::k_param_rc_3_old, Parameters::k_param_rc_4_old,
Parameters::k_param_rc_5_old, Parameters::k_param_rc_6_old,
Parameters::k_param_rc_7_old, Parameters::k_param_rc_8_old,
Parameters::k_param_rc_9_old, Parameters::k_param_rc_10_old,
Parameters::k_param_rc_11_old, Parameters::k_param_rc_12_old,
Parameters::k_param_rc_13_old, Parameters::k_param_rc_14_old };
const uint16_t old_aux_chan_mask = 0x3FFA;
SRV_Channels::upgrade_parameters(old_rc_keys, old_aux_chan_mask, &rcmap);
cliSerial->printf("load_all took %luus\n", micros() - before);
// set a more reasonable default NAVL1_PERIOD for rovers

View File

@ -9,9 +9,6 @@ void Rover::set_control_channels(void)
channel_throttle = RC_Channels::rc_channel(rcmap.throttle()-1);
channel_learn = RC_Channels::rc_channel(g.learn_channel-1);
SRV_Channels::set_default_function(CH_1, SRV_Channel::k_steering);
SRV_Channels::set_default_function(CH_3, SRV_Channel::k_throttle);
// set rc channel ranges
channel_steer->set_angle(SERVO_MAX);
channel_throttle->set_angle(100);