diff --git a/ArduPlane/navigation.pde b/ArduPlane/navigation.pde index bdbc5fa0cf..e4846c9ace 100644 --- a/ArduPlane/navigation.pde +++ b/ArduPlane/navigation.pde @@ -182,7 +182,7 @@ static void update_fbwb_speed_height(void) change_target_altitude(g.flybywire_climb_rate * elevator_input * delta_us_fast_loop * 0.0001f); - if (elevator_input == 0.0f && last_elevator_input != 0.0f) { + if (AP_Math::is_zero(elevator_input) && !AP_Math::is_zero(last_elevator_input)) { // the user has just released the elevator, lock in // the current altitude set_target_altitude_current(); diff --git a/ArduPlane/takeoff.pde b/ArduPlane/takeoff.pde index 2baf8632f4..47f14f3392 100644 --- a/ArduPlane/takeoff.pde +++ b/ArduPlane/takeoff.pde @@ -37,7 +37,7 @@ static bool auto_takeoff_check(void) // Check for launch acceleration or timer started. NOTE: relies on TECS 50Hz processing if (!launchTimerStarted && - g.takeoff_throttle_min_accel != 0.0f && + !AP_Math::is_zero(g.takeoff_throttle_min_accel) && SpdHgt_Controller->get_VXdot() < g.takeoff_throttle_min_accel) { goto no_launch; } @@ -65,7 +65,7 @@ static bool auto_takeoff_check(void) } // Check ground speed and time delay - if (((gps.ground_speed() > g.takeoff_throttle_min_speed || g.takeoff_throttle_min_speed == 0.0f)) && + if (((gps.ground_speed() > g.takeoff_throttle_min_speed || AP_Math::is_zero(g.takeoff_throttle_min_speed))) && ((now - last_tkoff_arm_time) >= wait_time_ms)) { gcs_send_text_fmt(PSTR("Triggered AUTO, GPSspd = %.1f"), gps.ground_speed()); launchTimerStarted = false;