From 596da5b7d33673f3e7b646b97cebae62b0647837 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Mon, 3 May 2021 22:15:52 +0200 Subject: [PATCH] Airspeed selector: use module params for FW_AIRSPD_STALL Signed-off-by: Silvan Fuhrer --- .../airspeed_selector/airspeed_selector_main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/modules/airspeed_selector/airspeed_selector_main.cpp b/src/modules/airspeed_selector/airspeed_selector_main.cpp index f9c4d890f4..3422af46c7 100644 --- a/src/modules/airspeed_selector/airspeed_selector_main.cpp +++ b/src/modules/airspeed_selector/airspeed_selector_main.cpp @@ -170,7 +170,9 @@ private: (ParamFloat) _tas_innov_threshold, /**< innovation check threshold */ (ParamFloat) _tas_innov_integ_threshold, /**< innovation check integrator threshold */ (ParamInt) _checks_fail_delay, /**< delay to declare airspeed invalid */ - (ParamInt) _checks_clear_delay /**< delay to declare airspeed valid again */ + (ParamInt) _checks_clear_delay, /**< delay to declare airspeed valid again */ + + (ParamFloat) _param_fw_airspd_stall ) void init(); /**< initialization of the airspeed validator instances */ @@ -345,11 +347,9 @@ AirspeedModule::Run() input_data.airspeed_timestamp = airspeed_raw.timestamp; input_data.air_temperature_celsius = airspeed_raw.air_temperature_celsius; - float airspeed_stall = 7.0f; - param_get(param_find("FW_AIRSPD_STALL"), &airspeed_stall); - // takeoff situation is active from start till one of the sensors' IAS or groundspeed_CAS is above stall speed - if (airspeed_raw.indicated_airspeed_m_s > airspeed_stall || _ground_minus_wind_CAS > airspeed_stall) { + if (airspeed_raw.indicated_airspeed_m_s > _param_fw_airspd_stall.get() + || _ground_minus_wind_CAS > _param_fw_airspd_stall.get()) { _in_takeoff_situation = false; } @@ -386,9 +386,6 @@ void AirspeedModule::update_params() { updateParams(); - float airspeed_stall = 7.0f; - param_get(param_find("FW_AIRSPD_STALL"), &airspeed_stall); - _wind_estimator_sideslip.set_wind_p_noise(_param_west_w_p_noise.get()); _wind_estimator_sideslip.set_tas_scale_p_noise(_param_west_sc_p_noise.get()); _wind_estimator_sideslip.set_tas_noise(_param_west_tas_noise.get()); @@ -413,7 +410,7 @@ void AirspeedModule::update_params() _airspeed_validator[i].set_tas_innov_integ_threshold(_tas_innov_integ_threshold.get()); _airspeed_validator[i].set_checks_fail_delay(_checks_fail_delay.get()); _airspeed_validator[i].set_checks_clear_delay(_checks_clear_delay.get()); - _airspeed_validator[i].set_airspeed_stall(airspeed_stall); + _airspeed_validator[i].set_airspeed_stall(_param_fw_airspd_stall.get()); } // if the airspeed scale estimation is enabled and the airspeed is valid,