fix(airspeed_selector): remove @volatile from ASPD_SCALE params, add 3% save threshold

Remove the @volatile flag from ASPD_SCALE_1/2/3 so the estimated
airspeed scale persists across reboots and can be transferred between
vehicles of the same model. The scale is primarily determined by pitot
position on the airframe, not the individual sensor.

To avoid corrupting the param transfer hash with negligible changes
every flight, raise the save threshold from FLT_EPSILON to 3% relative
change, per dev-call consensus.

Supersedes #22760

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jacob Dahl
2026-03-18 00:23:54 -08:00
committed by Silvan Fuhrer
parent 298ea3ed60
commit 0b956d9757
2 changed files with 3 additions and 4 deletions

View File

@@ -444,8 +444,10 @@ AirspeedModule::Run()
// save estimated airspeed scale after disarm if airspeed is valid and scale has changed
if (!armed && _armed_prev) {
const float scale_change_threshold = _param_airspeed_scale[i] * 0.03f; // 3% relative change threshold
if (_param_aspd_scale_apply.get() > 0 && _airspeed_validator[i].get_airspeed_valid()
&& fabsf(_airspeed_validator[i].get_CAS_scale_validated() - _param_airspeed_scale[i]) > FLT_EPSILON) {
&& fabsf(_airspeed_validator[i].get_CAS_scale_validated() - _param_airspeed_scale[i]) > scale_change_threshold) {
mavlink_log_info(&_mavlink_log_pub, "Airspeed sensor Nr. %d ASPD_SCALE updated: %.4f --> %.4f", i + 1,
(double)_param_airspeed_scale[i],

View File

@@ -96,7 +96,6 @@ PARAM_DEFINE_INT32(ASPD_SCALE_APPLY, 2);
* @max 2.0
* @decimal 2
* @group Airspeed Validator
* @volatile
*/
PARAM_DEFINE_FLOAT(ASPD_SCALE_1, 1.0f);
@@ -109,7 +108,6 @@ PARAM_DEFINE_FLOAT(ASPD_SCALE_1, 1.0f);
* @max 2.0
* @decimal 2
* @group Airspeed Validator
* @volatile
*/
PARAM_DEFINE_FLOAT(ASPD_SCALE_2, 1.0f);
@@ -122,7 +120,6 @@ PARAM_DEFINE_FLOAT(ASPD_SCALE_2, 1.0f);
* @max 2.0
* @decimal 2
* @group Airspeed Validator
* @volatile
*/
PARAM_DEFINE_FLOAT(ASPD_SCALE_3, 1.0f);