From 5984857751eed5267009ee8b33358a42b71da6e4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 31 May 2023 17:28:57 +1000 Subject: [PATCH] AP_ADSB: correct climbRate in SageTechMXS down vs up issue --- libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp b/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp index 2e389f83af..37aec8df7d 100644 --- a/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp +++ b/libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp @@ -334,9 +334,10 @@ void AP_ADSB_Sagetech_MXS::auto_config_operating() mxs_state.op.identOn = false; - float vertRate; - if (AP::ahrs().get_vert_pos_rate_D(vertRate)) { - mxs_state.op.climbRate = vertRate * SAGETECH_SCALE_M_PER_SEC_TO_FT_PER_MIN; + float vertRateD; + if (AP::ahrs().get_vert_pos_rate_D(vertRateD)) { + // convert from down to up, and scale appropriately: + mxs_state.op.climbRate = -vertRateD * SAGETECH_SCALE_M_PER_SEC_TO_FT_PER_MIN; mxs_state.op.climbValid = true; } else { mxs_state.op.climbValid = false;