Skip to content

Commit 31c22aa

Browse files
committed
Add lowairspeed binding and logic for airspeed monitoring
1 parent 0c402d0 commit 31c22aa

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

ExtLibs/ArduPilot/CurrentState.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,27 @@ 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 && parent.param.ContainsKey("AIRSPEED_MIN"))
3846+
{
3847+
_cachedAirspeedMin = (float)parent.param["AIRSPEED_MIN"].Value;
3848+
}
3849+
}
3850+
catch { }
3851+
3852+
_lastAirspeedMinCheck = DateTime.Now;
3853+
}
3854+
3855+
lowairspeed = armed
3856+
&& (timeSinceArmInAir > 0)
3857+
&& (_cachedAirspeedMin > 0)
3858+
&& sensors_enabled.differential_pressure
3859+
&& sensors_health.differential_pressure
3860+
&& (vfr.airspeed < _cachedAirspeedMin);
38383861
}
38393862

38403863
break;

GCSViews/FlightData.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)