diff --git a/Plane.FormationCreator/Formation/FlightTask_FlyTo.cs b/Plane.FormationCreator/Formation/FlightTask_FlyTo.cs
index fc01eb5..ecd4079 100644
--- a/Plane.FormationCreator/Formation/FlightTask_FlyTo.cs
+++ b/Plane.FormationCreator/Formation/FlightTask_FlyTo.cs
@@ -169,7 +169,7 @@ namespace Plane.FormationCreator.Formation
if (prevTask.TaskType == FlightTaskType.FlyTo && prevTask.LoiterTime == 0)
flyToTime += prevTask.RuningTaskRemaining;
}
-
+ int LEDIndex = 0;
//while (!info.Copter.ArrivedTarget(info.TargetLat, info.TargetLng, info.TargetAlt)) //按航点飞 :所有Copter到达目标点开始飞下个航点
while (ts.TotalMilliseconds < (flyToTime + loiterTime)) //按时间轴飞:当前任务时间到达后自动飞往下个航点
{
@@ -212,20 +212,21 @@ namespace Plane.FormationCreator.Formation
double time = 0;
for (int i = 0; i < LedControl.Count; i++)
{
-
var led = LedControl[i];
time += led.Delay * 1000;
if (ts.TotalMilliseconds >= time)
+ {
LEDRGB = info.LEDInfos[i].LEDRGB;
+ LEDIndex = i;
+
+ }
else
break;
}
+ Message.Show(LEDIndex.ToString());
info.Copter.LEDColor = LEDRGB;
-
}
-
-
if (ts.TotalMilliseconds / 10 > sendFlyToTimes) // 每500ms发送一遍指点坐标
{
sendFlyToTimes++;
diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs
index 1af61e9..9cd9151 100644
--- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs
+++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs
@@ -86,7 +86,7 @@ namespace Plane.FormationCreator.ViewModels
{
return _SendCommand ?? (_SendCommand = new RelayCommand(async () =>
{
- await SendCommandAsync(CopterNum);
+ await commModule.SetCommCount(CopterCount, (short)(CopterStartNum - 1));
}
));
}
@@ -132,6 +132,27 @@ namespace Plane.FormationCreator.ViewModels
set { Set(nameof(CopterColor), ref _CopterColor, value); }
}
+ private byte _TransmittedPower = 5;
+ public byte TransmittedPower
+ {
+ get { return _TransmittedPower; }
+ set { Set(nameof(TransmittedPower), ref _TransmittedPower, value); }
+ }
+
+ private short _CopterCount;
+ public short CopterCount
+ {
+ get { return _CopterCount; }
+ set { Set(nameof(CopterCount), ref _CopterCount, value); }
+ }
+
+ private short _CopterStartNum;
+ public short CopterStartNum
+ {
+ get { return _CopterStartNum; }
+ set { Set(nameof(CopterStartNum), ref _CopterStartNum, value); }
+ }
+
private ICommand _WriteIdCommand;
public ICommand WriteIdCommand
{
@@ -215,6 +236,9 @@ namespace Plane.FormationCreator.ViewModels
}
}
+ ///
+ /// 全部1S一次闪灯 主要用于测试通信
+ ///
private ICommand _CommDataAsync;
public ICommand CommDataAsync
{
@@ -228,6 +252,54 @@ namespace Plane.FormationCreator.ViewModels
}
}
+ ///
+ /// 设置回传功率
+ ///
+ private ICommand _CommSetPowerAsync;
+ public ICommand CommSetPowerAsync
+ {
+ get
+ {
+ return _CommSetPowerAsync ?? (_CommSetPowerAsync = new RelayCommand(async () =>
+ {
+ if (TransmittedPower >= 1 && TransmittedPower <= 16)
+ await commModule.SetCopterCommBackPower((short)CopterNum, TransmittedPower);
+ else
+ Alert.Show("功率范围只能设置为1-16");
+ }));
+ }
+ }
+
+ ///
+ /// 获取配置
+ ///
+ private ICommand _CommGetCurrSysParmAsync;
+ public ICommand CommGetCurrSysParmAsync
+ {
+ get
+ {
+ return _CommGetCurrSysParmAsync ?? (_CommGetCurrSysParmAsync = new RelayCommand(async () =>
+ {
+ await commModule.GetCurr_Sys_Parm();
+ }));
+ }
+ }
+
+ ///
+ /// 改写配置
+ ///
+ private ICommand _CommSetCurrSysParmAsync;
+ public ICommand CommSetCurrSysParmAsync
+ {
+ get
+ {
+ return _CommSetCurrSysParmAsync ?? (_CommSetCurrSysParmAsync = new RelayCommand(async () =>
+ {
+ await commModule.SetCurr_Sys_Parm();
+ }));
+ }
+ }
+
private List CreateLEDMissions(IEnumerable LEDInfos)
{
List missions = new List();
diff --git a/Plane.FormationCreator/Views/ConnectWindow.xaml b/Plane.FormationCreator/Views/ConnectWindow.xaml
index b5a8da8..2d15135 100644
--- a/Plane.FormationCreator/Views/ConnectWindow.xaml
+++ b/Plane.FormationCreator/Views/ConnectWindow.xaml
@@ -68,6 +68,8 @@
+
+
@@ -89,7 +91,8 @@
HorizontalAlignment="Center"
Grid.Row="1"
Grid.ColumnSpan="3"
- Name="panel1">
+ Name="panel1"
+ Visibility="Collapsed">
-
+
@@ -142,21 +145,44 @@
HorizontalAlignment="Center"
Grid.Row="3"
Grid.ColumnSpan="3">
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+