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走马灯显示效果