@@ -503,6 +503,8 @@ public float airspeed
503503 public float targetairspeed { get ; private set ; }
504504
505505 public bool lowairspeed { get ; set ; }
506+ private float _cachedAirspeedMin = 0 ;
507+ private DateTime _lastAirspeedMinCheck = DateTime . MinValue ;
506508
507509 [ DisplayFieldName ( "asratio.Field" ) ]
508510 [ DisplayText ( "Airspeed Ratio" ) ]
@@ -3835,6 +3837,37 @@ private void Parent_OnPacketReceived(object sender, MAVLink.MAVLinkMessage mavLi
38353837 //This comes from the EKF, so it supposed to be correct
38363838 climbrate = vfr . climb ;
38373839 gotVFR = true ; // we have a vfr packet
3840+
3841+ if ( ( timeSinceArmInAir > 0 ) && ( DateTime . Now - _lastAirspeedMinCheck ) . TotalSeconds > 5 )
3842+ {
3843+ try
3844+ {
3845+ if ( parent ? . param != null )
3846+ {
3847+ if ( parent . param . ContainsKey ( "AIRSPEED_MIN" ) )
3848+ {
3849+ _cachedAirspeedMin = ( float ) parent . param [ "AIRSPEED_MIN" ] . Value ;
3850+ }
3851+ else if ( parent . param . ContainsKey ( "ARSPD_FBW_MIN" ) )
3852+ {
3853+ _cachedAirspeedMin = ( float ) parent . param [ "ARSPD_FBW_MIN" ] . Value ;
3854+ }
3855+ }
3856+ }
3857+ catch ( Exception ex )
3858+ {
3859+ log . Debug ( "Error getting AIRSPEED_MIN or ARSPD_FBW_MIN from param for lowairspeed handling" , ex ) ;
3860+ }
3861+
3862+ _lastAirspeedMinCheck = DateTime . Now ;
3863+ }
3864+
3865+ lowairspeed = armed
3866+ && ( timeSinceArmInAir > 0 )
3867+ && ( _cachedAirspeedMin > 0 )
3868+ && sensors_enabled . differential_pressure
3869+ && sensors_health . differential_pressure
3870+ && ( vfr . airspeed < _cachedAirspeedMin ) ;
38383871 }
38393872
38403873 break ;
0 commit comments