From 471f0ba872d518d8f42796baa14cc0e7f938665d Mon Sep 17 00:00:00 2001 From: panxu Date: Wed, 11 Jul 2018 10:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E4=BA=86=E5=87=8F=E5=B0=8F=E9=80=9A?= =?UTF-8?q?=E8=AE=AF=EF=BC=8C=E4=B8=8D=E5=8F=91=E5=BF=83=E8=B7=B3=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E9=80=9A=E9=81=93=E5=8C=85=EF=BC=8Crtk?= =?UTF-8?q?=E5=8C=85=E7=AD=89=EF=BC=8C=E4=B8=8D=E5=8F=91=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E4=B9=9F=E6=B2=A1=E9=97=AE=E9=A2=98=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8F=82=E6=95=B0=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4=20=E9=99=8D?= =?UTF-8?q?=E4=BD=8E=E9=80=9A=E9=81=93=E5=8F=91=E9=80=81=E9=A2=91=E7=8E=87?= =?UTF-8?q?=E4=B8=BA2=E6=AC=A1/=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs | 4 +++- PlaneGcsSdk_Shared/Copters/PLCopter.cs | 10 +++++++--- PlaneGcsSdk_Shared/Copters/PlaneCopter.cs | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs index d822912..2da9e88 100644 --- a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs +++ b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs @@ -170,6 +170,7 @@ namespace Plane.Copters await Task.Delay(_intervalToUpdateFlightTimeSpan).ConfigureAwait(false); } }); + Task.Run(async () => { while (true) @@ -182,9 +183,10 @@ namespace Plane.Copters { StatusText = null; } - await Task.Delay(50); + await Task.Delay(500); //50 } }); + Task.Run(async () => { var lastHeartbeatCount = HeartbeatCount; diff --git a/PlaneGcsSdk_Shared/Copters/PLCopter.cs b/PlaneGcsSdk_Shared/Copters/PLCopter.cs index acbc1ae..658960c 100644 --- a/PlaneGcsSdk_Shared/Copters/PLCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PLCopter.cs @@ -221,12 +221,16 @@ namespace Plane.Copters var stopwatch = Stopwatch.StartNew(); while (true) { - for (int ii = 0; ii < 5; ii++) + /* for (int ii = 0; ii < 5; ii++) { await _internalCopter.SetParam2Async(paramName, paramValue).ConfigureAwait(false); await Task.Delay(5).ConfigureAwait(false); } - + */ + + await _internalCopter.SetParam2Async(paramName, paramValue).ConfigureAwait(false); + await Task.Delay(5).ConfigureAwait(false); + int i = 0; try { @@ -235,7 +239,7 @@ namespace Plane.Copters // await Task.Delay(5).ConfigureAwait(false); //} - if (await _internalCopter.GetParamAsync(paramName, 1000) == paramValue) + // if (await _internalCopter.GetParamAsync(paramName, millisecondsTimeout) == paramValue) { i = 1; } diff --git a/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs b/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs index b34527c..161ee1a 100644 --- a/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PlaneCopter.cs @@ -212,7 +212,7 @@ namespace Plane.Copters autopilot = (byte)MAVLink.MAV_AUTOPILOT.GENERIC, mavlink_version = 3, }; - await SendPacketAsync(htb).ConfigureAwait(false); //发心跳包 + // await SendPacketAsync(htb).ConfigureAwait(false); //发心跳包 #if DEBUG && LOG_PACKETS if (!_sendHeartbeatStopwatch.IsRunning) {