Sub: initialise celsius library on configured (barometer) external bus

This commit is contained in:
Peter Barker 2020-12-02 21:15:44 +11:00 committed by Andrew Tridgell
parent 6f7fbece49
commit 6e5e73ef2c
1 changed files with 15 additions and 17 deletions

View File

@ -19,23 +19,6 @@ void Sub::init_ardupilot()
can_mgr.init();
#endif
#if AP_FEATURE_BOARD_DETECT
// 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);
celsius.init(0);
break;
default:
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
celsius.init(1);
break;
}
#else
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
celsius.init(1);
#endif
// init cargo gripper
#if GRIPPER_ENABLED == ENABLED
g2.gripper.init();
@ -53,6 +36,21 @@ void Sub::init_ardupilot()
barometer.init();
#if AP_FEATURE_BOARD_DETECT
// 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
celsius.init(barometer.external_bus());
// setup telem slots with serial ports
gcs().setup_uarts();