修改小问题,加入飞机亮灯显示,加入飞行航线亮灯控制
[App.xaml.cs]修改报错的bug [FlightTaskManager.cs] 防止报错 [FlightTask_FlyTo.cs]加入亮灯控制 [FlightTask_TakeOff.cs]起飞时打开灯,平飞是关闭灯 [MainWindow.xaml.cs]从本地得到亮灯变量,不用异步取 [MapView_CopterDrawing.cs]亮灯时显示个外边框 [ModifyTaskView.xaml]飞往加入亮灯控制开关
This commit is contained in:
parent
517146971f
commit
64b4412ff4
@ -54,8 +54,16 @@ namespace Plane.FormationCreator
|
|||||||
};
|
};
|
||||||
this.Exit += (s, e) =>
|
this.Exit += (s, e) =>
|
||||||
{
|
{
|
||||||
TcpServerConnectionManager.Instance.StopListening();
|
try
|
||||||
UdpServerConnectionManager.Instance.StopReceiving();
|
{
|
||||||
|
TcpServerConnectionManager.Instance.StopListening();
|
||||||
|
UdpServerConnectionManager.Instance.StopReceiving();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// RaiseExceptionThrown(ex);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
//new Test().Prepare().Run();
|
//new Test().Prepare().Run();
|
||||||
}
|
}
|
||||||
@ -110,6 +118,7 @@ namespace Plane.FormationCreator
|
|||||||
if (!TcpServerConnectionManager.Instance.StartListening())
|
if (!TcpServerConnectionManager.Instance.StartListening())
|
||||||
{
|
{
|
||||||
Alert.Show("网络连接不正常,无法启动监听。");
|
Alert.Show("网络连接不正常,无法启动监听。");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
UdpServerConnectionManager.Instance.ExceptionThrown += (sender, e1) =>
|
UdpServerConnectionManager.Instance.ExceptionThrown += (sender, e1) =>
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,8 @@ namespace Plane.FormationCreator.Formation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedCopter.SetShowLEDFlashAsync(1, 100);
|
if (selectedCopter!=null)
|
||||||
|
selectedCopter.SetShowLEDFlashAsync(1, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
TaskAdded += (sender, e) =>
|
TaskAdded += (sender, e) =>
|
||||||
@ -189,7 +190,15 @@ namespace Plane.FormationCreator.Formation
|
|||||||
newTask.SingleCopterInfos.Add(newSingleCopterInfo);
|
newTask.SingleCopterInfos.Add(newSingleCopterInfo);
|
||||||
}
|
}
|
||||||
Tasks.Add(newTask);
|
Tasks.Add(newTask);
|
||||||
TaskAdded?.Invoke(this, new FlightTaskAddedEventArgs { LastTask = lastTask, AddedTask = newTask });
|
try
|
||||||
|
{
|
||||||
|
TaskAdded?.Invoke(this, new FlightTaskAddedEventArgs { LastTask = lastTask, AddedTask = newTask });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//RaiseExceptionThrown(ex);
|
||||||
|
}
|
||||||
|
|
||||||
SelectedTask = newTask;
|
SelectedTask = newTask;
|
||||||
SelectedTaskIndex = Tasks.Count - 1;
|
SelectedTaskIndex = Tasks.Count - 1;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,15 @@ namespace Plane.FormationCreator.Formation
|
|||||||
set { Set(nameof(StaggerRoutes), ref _StaggerRoutes, value); }
|
set { Set(nameof(StaggerRoutes), ref _StaggerRoutes, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool _FlytoShowLED = true;
|
||||||
|
public bool FlytoShowLED
|
||||||
|
{
|
||||||
|
get { return _FlytoShowLED; }
|
||||||
|
set { Set(nameof(FlytoShowLED), ref _FlytoShowLED, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool _VerticalLift = false;
|
private bool _VerticalLift = false;
|
||||||
public bool VerticalLift // 垂直升降标志位,后面需要加入即使拖动地图上的飞机,也不会变化经纬度. added by ZJF
|
public bool VerticalLift // 垂直升降标志位,后面需要加入即使拖动地图上的飞机,也不会变化经纬度. added by ZJF
|
||||||
{
|
{
|
||||||
@ -522,7 +531,8 @@ namespace Plane.FormationCreator.Formation
|
|||||||
tasks[i] = await Task.Factory.StartNew(async () =>
|
tasks[i] = await Task.Factory.StartNew(async () =>
|
||||||
{
|
{
|
||||||
var internalInfo = info;
|
var internalInfo = info;
|
||||||
//if (i1 > 0)
|
await info.Copter.SetShowLEDAsync(FlytoShowLED);
|
||||||
|
//if (i1 > 0)
|
||||||
//{
|
//{
|
||||||
// var prevCopter = infos[i1 - 1].Copter;
|
// var prevCopter = infos[i1 - 1].Copter;
|
||||||
// while (CheckCrossing(infos, i1) &&
|
// while (CheckCrossing(infos, i1) &&
|
||||||
|
@ -143,7 +143,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//await copter.SetShowLEDAsync(true);
|
await copter.SetShowLEDAsync(true);
|
||||||
await copter.UnlockAsync();
|
await copter.UnlockAsync();
|
||||||
for (int i = 0; !copter.IsUnlocked; i++)
|
for (int i = 0; !copter.IsUnlocked; i++)
|
||||||
{
|
{
|
||||||
@ -225,6 +225,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
if (info.takeOffStage == 1)
|
if (info.takeOffStage == 1)
|
||||||
{
|
{
|
||||||
await info.Copter.GuidAsync();
|
await info.Copter.GuidAsync();
|
||||||
|
await info.Copter.SetShowLEDAsync(false);
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
await info.Copter.FlyToAsync(copterNextTask.TargetLat, copterNextTask.TargetLng, takeOffAlt);
|
await info.Copter.FlyToAsync(copterNextTask.TargetLat, copterNextTask.TargetLng, takeOffAlt);
|
||||||
|
@ -111,7 +111,7 @@ namespace Plane.FormationCreator
|
|||||||
var copters = _copterManager.AcceptingControlCopters;
|
var copters = _copterManager.AcceptingControlCopters;
|
||||||
await Task.WhenAll(copters.Select(async copter =>
|
await Task.WhenAll(copters.Select(async copter =>
|
||||||
{
|
{
|
||||||
isledon = await copter.GetShowLEDAsync();
|
isledon = copter.GetShowLEDAsync();
|
||||||
await copter.SetShowLEDAsync(!isledon);
|
await copter.SetShowLEDAsync(!isledon);
|
||||||
})).ConfigureAwait(false);
|
})).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
<TextBlock Text="{Binding Path=SatCount}" />
|
<TextBlock Text="{Binding Path=SatCount}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Heading:" />
|
<TextBlock Text="方向:" />
|
||||||
<TextBlock Text="{Binding Path=Heading}" />
|
<TextBlock Text="{Binding Path=Heading}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!--<StackPanel>
|
<!--<StackPanel>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
<TextBlock Text="{Binding FlightDistance, StringFormat=0.##}" />
|
<TextBlock Text="{Binding FlightDistance, StringFormat=0.##}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Fix type:" />
|
<TextBlock Text="锁定类型:" />
|
||||||
<TextBlock Text="{Binding GpsFixType}" />
|
<TextBlock Text="{Binding GpsFixType}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!--
|
<!--
|
||||||
@ -156,7 +156,7 @@
|
|||||||
<TextBlock Text="{Binding Channel4}" />
|
<TextBlock Text="{Binding Channel4}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="HDOP:" />
|
<TextBlock Text="定位精度:" />
|
||||||
<TextBlock Text="{Binding GpsHdop, StringFormat=0.##}" />
|
<TextBlock Text="{Binding GpsHdop, StringFormat=0.##}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -94,6 +94,7 @@ namespace Plane.FormationCreator.Views
|
|||||||
var location = new Location(Copter.Latitude, Copter.Longitude, Copter.Altitude);
|
var location = new Location(Copter.Latitude, Copter.Longitude, Copter.Altitude);
|
||||||
Point center = _map.LocationToViewportPoint(location);
|
Point center = _map.LocationToViewportPoint(location);
|
||||||
bool locationUpdated = true;
|
bool locationUpdated = true;
|
||||||
|
SolidColorBrush blackBrush = new SolidColorBrush();
|
||||||
if (this.Dot == null)
|
if (this.Dot == null)
|
||||||
{
|
{
|
||||||
Track = new MapPolyline();
|
Track = new MapPolyline();
|
||||||
@ -109,6 +110,7 @@ namespace Plane.FormationCreator.Views
|
|||||||
Dot.Points.Add(new Point(COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
|
Dot.Points.Add(new Point(COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
|
||||||
|
|
||||||
Dot.Fill = _brush; // new SolidColorBrush(Color.FromArgb(200, 0, 122, 204));
|
Dot.Fill = _brush; // new SolidColorBrush(Color.FromArgb(200, 0, 122, 204));
|
||||||
|
Dot.StrokeThickness = 1;
|
||||||
Dot.Width = COPTER_RADIUS * 2;
|
Dot.Width = COPTER_RADIUS * 2;
|
||||||
Dot.Height = COPTER_RADIUS * 2;
|
Dot.Height = COPTER_RADIUS * 2;
|
||||||
ToolTip tt = new ToolTip();
|
ToolTip tt = new ToolTip();
|
||||||
@ -149,6 +151,12 @@ namespace Plane.FormationCreator.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Copter.GetShowLEDAsync())
|
||||||
|
blackBrush.Color = Colors.White;
|
||||||
|
else
|
||||||
|
blackBrush.Color = Colors.Transparent;
|
||||||
|
Dot.Stroke = blackBrush;
|
||||||
|
|
||||||
var trans = Dot.RenderTransform as RotateTransform;
|
var trans = Dot.RenderTransform as RotateTransform;
|
||||||
if (trans == null)
|
if (trans == null)
|
||||||
{
|
{
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
@ -104,6 +105,11 @@
|
|||||||
<TextBlock Grid.Row="1" Text="垂直升降: " />
|
<TextBlock Grid.Row="1" Text="垂直升降: " />
|
||||||
<CheckBox Grid.Row="1" Grid.Column="1"
|
<CheckBox Grid.Row="1" Grid.Column="1"
|
||||||
IsChecked="{Binding VerticalLift}" />
|
IsChecked="{Binding VerticalLift}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Text="开灯: " />
|
||||||
|
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||||
|
IsChecked="{Binding FlytoShowLED}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Separator Grid.Row="1" />
|
<Separator Grid.Row="1" />
|
||||||
|
Loading…
Reference in New Issue
Block a user