From 625bd3ade991b1ff5d54e9f82c978d7ec8b82f19 Mon Sep 17 00:00:00 2001 From: pxzleo Date: Sun, 17 Sep 2017 12:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=AC=E5=81=9C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=99=AE=E9=80=9A=E9=97=AA=E7=81=AF=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E4=B9=9F=E4=B8=8D=E8=83=BD=E4=B8=8B=E4=B8=80=E6=AD=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Formation/FlightTask_LoiterTime.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Plane.FormationCreator/Formation/FlightTask_LoiterTime.cs b/Plane.FormationCreator/Formation/FlightTask_LoiterTime.cs index 35e3bb2..73c83a7 100644 --- a/Plane.FormationCreator/Formation/FlightTask_LoiterTime.cs +++ b/Plane.FormationCreator/Formation/FlightTask_LoiterTime.cs @@ -353,8 +353,26 @@ namespace Plane.FormationCreator.Formation // LED灯全亮 await Task.WhenAll(SingleCopterInfos.Select(info => LEDFlashTaskFlySingleCopterAsync(info, true))); //延时等待 - await Task.Delay((int)(LoiterTimeAttr * 1000)).ConfigureAwait(false); + + //判断是否下一步 + DateTime start = DateTime.Now; + while (true) + { + if (_flightTaskManager.IsPaused == true) + { + await Task.WhenAll(SingleCopterInfos.Select(info => (info.Copter.HoverAsync()))); + return; + } + + DateTime end = DateTime.Now; + TimeSpan ts = end - start; + //等待指定时间 + if (ts.TotalMilliseconds > LoiterTimeAttr * 1000) + return; + await Task.Delay(20).ConfigureAwait(false); + + } } else if (oneByOneAttr) // LED走马灯显示效果