From b08e1e6919f8bcc0d0fb9199c93e4555dad0e0fc Mon Sep 17 00:00:00 2001 From: jaxxzer Date: Sat, 23 Jan 2016 00:57:40 -0500 Subject: [PATCH] Sub: Update land mode to move up instead of down. --- ArduSub/control_land.cpp | 6 +++--- ArduSub/land_detector.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ArduSub/control_land.cpp b/ArduSub/control_land.cpp index 4d51549ccc..429372ca75 100644 --- a/ArduSub/control_land.cpp +++ b/ArduSub/control_land.cpp @@ -215,10 +215,10 @@ float Sub::get_land_descent_speed() bool sonar_ok = false; #endif // if we are above 10m and the sonar does not sense anything perform regular alt hold descent - if (pos_control.get_pos_target().z >= pv_alt_above_origin(LAND_START_ALT) && !(sonar_ok && sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) { - return pos_control.get_speed_down(); + if (pos_control.get_pos_target().z <= pv_alt_above_origin(LAND_START_ALT) && !(sonar_ok && sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) { + return pos_control.get_speed_up(); }else{ - return -abs(g.land_speed); + return abs(g.land_speed); } } diff --git a/ArduSub/land_detector.cpp b/ArduSub/land_detector.cpp index 61e74db751..d42f8925ee 100644 --- a/ArduSub/land_detector.cpp +++ b/ArduSub/land_detector.cpp @@ -24,7 +24,7 @@ void Sub::update_land_and_crash_detectors() // called at MAIN_LOOP_RATE void Sub::update_land_detector() { - if(barometer.get_altitude() > SURFACE_END_DEPTH && ap.throttle_zero) { + if(barometer.num_instances() > 1 && barometer.get_altitude() > SURFACE_END_DEPTH && ap.throttle_zero) { set_land_complete(true); } else { set_land_complete(false);