Sub: Move SITL barometer check to control_check_barometer

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2018-05-07 13:31:35 -03:00 committed by Jacob Walser
parent f075d6bd93
commit e62b560095
3 changed files with 2 additions and 4 deletions

View File

@ -341,6 +341,7 @@ void Sub::update_altitude()
bool Sub::control_check_barometer()
{
#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if (!ap.depth_sensor_present) { // can't hold depth without a depth sensor
gcs().send_text(MAV_SEVERITY_WARNING, "Depth sensor is not connected.");
return false;
@ -348,6 +349,7 @@ bool Sub::control_check_barometer()
gcs().send_text(MAV_SEVERITY_WARNING, "Depth sensor error.");
return false;
}
#endif
return true;
}

View File

@ -8,11 +8,9 @@
// althold_init - initialise althold controller
bool Sub::althold_init()
{
#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if(!control_check_barometer()) {
return false;
}
#endif
// initialize vertical speeds and leash lengths
// sets the maximum speed up and down returned by position controller

View File

@ -3,11 +3,9 @@
bool Sub::surface_init()
{
#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if(!control_check_barometer()) {
return false;
}
#endif
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(wp_nav.get_speed_down(), wp_nav.get_speed_up());