Sub: Send a clear message if depth sensor is not connected

Fix bluerobotics/ardusub#151

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2018-04-14 00:16:57 -03:00 committed by Jacob Walser
parent 8fa1700d02
commit 0878f5044c
4 changed files with 16 additions and 4 deletions

View File

@ -339,4 +339,16 @@ void Sub::update_altitude()
}
}
bool Sub::control_check_barometer()
{
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;
} else if (failsafe.sensor_health) {
gcs().send_text(MAV_SEVERITY_WARNING, "Depth sensor error.");
return false;
}
return true;
}
AP_HAL_MAIN_CALLBACKS(&sub);

View File

@ -708,6 +708,8 @@ private:
void convert_old_parameters(void);
bool control_check_barometer();
enum Failsafe_Action {
Failsafe_Action_None = 0,
Failsafe_Action_Warn = 1,

View File

@ -9,8 +9,7 @@
bool Sub::althold_init()
{
#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if (!ap.depth_sensor_present || failsafe.sensor_health) { // can't hold depth without a depth sensor, exit immediately.
gcs().send_text(MAV_SEVERITY_WARNING, "BAD DEPTH");
if(!control_check_barometer()) {
return false;
}
#endif

View File

@ -4,8 +4,7 @@
bool Sub::surface_init()
{
#if CONFIG_HAL_BOARD != HAL_BOARD_SITL
if (!ap.depth_sensor_present || failsafe.sensor_health) { // can't hold depth without a depth sensor, exit immediately.
gcs().send_text(MAV_SEVERITY_WARNING, "BAD DEPTH");
if(!control_check_barometer()) {
return false;
}
#endif