[FlightTask_FlyTo.cs]修改bug暂停后无法继续-未进入guided模式
[FlightTask_LoiterTime.cs]飞机标记时以后任务跳过 [FlightTask_TakeOff.cs]解锁加入5秒时间限制 [ControlPanelViewModel.cs]加入解锁测试功能,解锁全部飞机保持10秒再加锁 [ControlPanelView.xaml]打开测试按钮
This commit is contained in:
parent
93ed6f778a
commit
3802af10ca
@ -643,10 +643,15 @@ namespace Plane.FormationCreator.Formation
|
||||
int taskIndex = _flightTaskManager.CurrentRunningTaskIndex;
|
||||
int copterIndex = SingleCopterInfos.IndexOf(info);
|
||||
|
||||
// 当该飞机被标记时,跳过飞行任务
|
||||
if ((bool)_copterManager.CopterStatus[copterIndex])
|
||||
return;
|
||||
|
||||
await info.Copter.SetShowLEDAsync(info.FlytoShowLED);
|
||||
|
||||
if (info.Copter.State != Plane.Copters.CopterState.CommandMode)
|
||||
await info.Copter.GuidAsync();
|
||||
|
||||
DateTime dtNow = DateTime.Now;
|
||||
DateTime dtLastTime = DateTime.Now;
|
||||
TimeSpan ts = dtNow - dtLastTime;
|
||||
|
@ -353,7 +353,18 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
var copter = info.Copter;
|
||||
|
||||
// await Task.Delay(200).ConfigureAwait(false);
|
||||
// await Task.Delay(200).ConfigureAwait(false);
|
||||
|
||||
int copterIndex = SingleCopterInfos.IndexOf(info);
|
||||
// 当该飞机被标记时,跳过飞行任务
|
||||
if ((bool)_copterManager.CopterStatus[copterIndex])
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var tasks = new Task[1];
|
||||
tasks[0] = Task.Run(async () =>
|
||||
@ -383,6 +394,11 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
var copter = info.Copter;
|
||||
|
||||
int copterIndex = SingleCopterInfos.IndexOf(info);
|
||||
// 当该飞机被标记时,跳过飞行任务
|
||||
if ((bool)_copterManager.CopterStatus[copterIndex])
|
||||
return;
|
||||
|
||||
var tasks = new Task[1];
|
||||
tasks[0] = Task.Run(async () =>
|
||||
{
|
||||
@ -434,6 +450,12 @@ namespace Plane.FormationCreator.Formation
|
||||
private async Task LEDFlashTaskFlySingleCopterAsync(FlightTaskSingleCopterInfo info, bool isOn)
|
||||
{
|
||||
var copter = info.Copter;
|
||||
|
||||
int copterIndex = SingleCopterInfos.IndexOf(info);
|
||||
// 当该飞机被标记时,跳过飞行任务
|
||||
if ((bool)_copterManager.CopterStatus[copterIndex])
|
||||
return;
|
||||
|
||||
// float gpsLed = await c.GetParamAsync("NOTI_GPSLED");
|
||||
|
||||
/*
|
||||
|
@ -163,10 +163,16 @@ namespace Plane.FormationCreator.Formation
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//5秒内每1000毫秒尝试解锁一次
|
||||
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||
|
||||
if (i > 200)
|
||||
break;
|
||||
if (i % (1000 / 25) == 1000 / 25 - 1)
|
||||
{
|
||||
await copter.UnlockAsync(); // 每 1000 毫秒重试一次。
|
||||
}
|
||||
|
||||
await Task.Delay(25).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -48,11 +48,14 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
await Task.WhenAll(_copterManager.AcceptingControlCopters.Select( async c => {
|
||||
await c.UnlockAsync();
|
||||
//解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||
for (int i = 0; !c.IsUnlocked; i++)
|
||||
{
|
||||
if (i > 200)
|
||||
break;
|
||||
if (i % (1000 / 25) == 1000 / 25 - 1)
|
||||
{
|
||||
await c.UnlockAsync(); // 每 1000 毫秒重试一次。
|
||||
await c.UnlockAsync(); // 每 1000 毫秒重试一次。解锁间隔一定要超过1s否则导致飞控以后无法解锁
|
||||
}
|
||||
await Task.Delay(25).ConfigureAwait(false);
|
||||
}
|
||||
@ -255,6 +258,33 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
return _TestCommand ?? (_TestCommand = new RelayCommand(async () =>
|
||||
{
|
||||
|
||||
foreach (var vcopter in _copterManager.Copters)
|
||||
{
|
||||
await vcopter.UnlockAsync();
|
||||
}
|
||||
|
||||
await Task.Delay(10000);
|
||||
|
||||
foreach (var vcopter in _copterManager.Copters)
|
||||
{
|
||||
await vcopter.LockAsync();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var firstCopter = _copterManager.Copters.First();
|
||||
|
||||
// Test TurnAsync.
|
||||
|
@ -52,7 +52,7 @@
|
||||
<Button Content="跳过"
|
||||
Command="{Binding FlagCommand}" />
|
||||
<Button Content="测试"
|
||||
Visibility="Hidden"
|
||||
|
||||
Command="{Binding TestCommand}" />
|
||||
<TextBox Width="50"
|
||||
Visibility="Hidden"
|
||||
|
Loading…
Reference in New Issue
Block a user