Sub: Set default external baro bus correctly for Pixhawk 2

This commit is contained in:
Jacob Walser 2017-08-18 17:11:03 -04:00
parent 09a640e270
commit 6265436186
2 changed files with 14 additions and 1 deletions

View File

@ -799,7 +799,6 @@ void Sub::load_parameters(void)
convert_old_parameters();
AP_Param::set_default_by_name("BRD_SAFETYENABLE", 0);
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
AP_Param::set_default_by_name("ARMING_CHECK",
AP_Arming::ARMING_CHECK_RC |
AP_Arming::ARMING_CHECK_VOLTAGE |

View File

@ -32,6 +32,20 @@ void Sub::init_ardupilot()
BoardConfig.init();
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
// Detection won't work until after BoardConfig.init()
switch (AP_BoardConfig::get_board_type()) {
case AP_BoardConfig::PX4_BOARD_PIXHAWK2:
AP_Param::set_default_by_name("GND_EXT_BUS", 0);
break;
default:
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
break;
}
#else
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
#endif
// initialise serial port
serial_manager.init();