From a2e72de5ae3cbcb2edbd3c7fa3bca2bd2b477134 Mon Sep 17 00:00:00 2001 From: Peter Hall <33176108+IamPete1@users.noreply.github.com> Date: Tue, 7 Jan 2020 00:45:27 +0000 Subject: [PATCH] Plane: move to airspeed_estimate with pointer --- ArduPlane/Attitude.cpp | 2 +- ArduPlane/GCS_Mavlink.cpp | 2 +- ArduPlane/Log.cpp | 2 +- ArduPlane/is_flying.cpp | 2 +- ArduPlane/navigation.cpp | 2 +- ArduPlane/quadplane.cpp | 6 +++--- ArduPlane/sensors.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ArduPlane/Attitude.cpp b/ArduPlane/Attitude.cpp index 465eb61da68..f9b6a03247a 100644 --- a/ArduPlane/Attitude.cpp +++ b/ArduPlane/Attitude.cpp @@ -8,7 +8,7 @@ float Plane::get_speed_scaler(void) { float aspeed, speed_scaler; - if (ahrs.airspeed_estimate(&aspeed)) { + if (ahrs.airspeed_estimate(aspeed)) { if (aspeed > auto_state.highest_airspeed) { auto_state.highest_airspeed = aspeed; } diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index 348875082d1..064a1b748b0 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -247,7 +247,7 @@ float GCS_MAVLINK_Plane::vfr_hud_airspeed() const // airspeed estimates are OK: float aspeed; - if (AP::ahrs().airspeed_estimate(&aspeed)) { + if (AP::ahrs().airspeed_estimate(aspeed)) { return aspeed; } diff --git a/ArduPlane/Log.cpp b/ArduPlane/Log.cpp index 0e3c9c1fd33..30b5fa4b05e 100644 --- a/ArduPlane/Log.cpp +++ b/ArduPlane/Log.cpp @@ -96,7 +96,7 @@ struct PACKED log_Control_Tuning { void Plane::Log_Write_Control_Tuning() { float est_airspeed = 0; - ahrs.airspeed_estimate(&est_airspeed); + ahrs.airspeed_estimate(est_airspeed); struct log_Control_Tuning pkt = { LOG_PACKET_HEADER_INIT(LOG_CTUN_MSG), diff --git a/ArduPlane/is_flying.cpp b/ArduPlane/is_flying.cpp index 8a367ea3724..7a65725a3d0 100644 --- a/ArduPlane/is_flying.cpp +++ b/ArduPlane/is_flying.cpp @@ -24,7 +24,7 @@ void Plane::update_is_flying_5Hz(void) // airspeed at least 75% of stall speed? const float airspeed_threshold = MAX(aparm.airspeed_min,2)*0.75f; - bool airspeed_movement = ahrs.airspeed_estimate(&aspeed) && (aspeed >= airspeed_threshold); + bool airspeed_movement = ahrs.airspeed_estimate(aspeed) && (aspeed >= airspeed_threshold); if (gps.status() < AP_GPS::GPS_OK_FIX_2D && arming.is_armed() && !airspeed_movement && isFlyingProbability > 0.3) { // when flying with no GPS, use the last airspeed estimate to diff --git a/ArduPlane/navigation.cpp b/ArduPlane/navigation.cpp index a1366dadb68..12a67eadc0e 100644 --- a/ArduPlane/navigation.cpp +++ b/ArduPlane/navigation.cpp @@ -104,7 +104,7 @@ void Plane::calc_airspeed_errors() // we use the airspeed estimate function not direct sensor as TECS // may be using synthetic airspeed - ahrs.airspeed_estimate(&airspeed_measured); + ahrs.airspeed_estimate(airspeed_measured); // FBW_B/cruise airspeed target if (!failsafe.rc_failsafe && (control_mode == &mode_fbwb || control_mode == &mode_cruise)) { diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 93509905ebe..e46ed7dd6d2 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -1408,7 +1408,7 @@ float QuadPlane::assist_climb_rate_cms(void) const float QuadPlane::desired_auto_yaw_rate_cds(void) const { float aspeed; - if (!ahrs.airspeed_estimate(&aspeed) || aspeed < plane.aparm.airspeed_min) { + if (!ahrs.airspeed_estimate(aspeed) || aspeed < plane.aparm.airspeed_min) { aspeed = plane.aparm.airspeed_min; } if (aspeed < 1) { @@ -1538,7 +1538,7 @@ void QuadPlane::update_transition(void) } float aspeed; - bool have_airspeed = ahrs.airspeed_estimate(&aspeed); + bool have_airspeed = ahrs.airspeed_estimate(aspeed); // tailsitters use angle wait, not airspeed wait if (is_tailsitter() && transition_state == TRANSITION_AIRSPEED_WAIT) { @@ -1919,7 +1919,7 @@ void QuadPlane::update_throttle_hover() // calc average throttle if we are in a level hover and low airspeed if (throttle > 0.0f && fabsf(inertial_nav.get_velocity_z()) < 60 && labs(ahrs_view->roll_sensor) < 500 && labs(ahrs_view->pitch_sensor) < 500 && - ahrs.airspeed_estimate(&aspeed) && aspeed < plane.aparm.airspeed_min*0.3) { + ahrs.airspeed_estimate(aspeed) && aspeed < plane.aparm.airspeed_min*0.3) { // Can we set the time constant automatically motors->update_throttle_hover(0.01f); } diff --git a/ArduPlane/sensors.cpp b/ArduPlane/sensors.cpp index c125891fbc2..0850852173e 100644 --- a/ArduPlane/sensors.cpp +++ b/ArduPlane/sensors.cpp @@ -66,7 +66,7 @@ void Plane::read_airspeed(void) // update smoothed airspeed estimate float aspeed; - if (ahrs.airspeed_estimate(&aspeed)) { + if (ahrs.airspeed_estimate(aspeed)) { smoothed_airspeed = smoothed_airspeed * 0.8f + aspeed * 0.2f; } }