添加测试拉烟的功能

添加多参数同时写入(用于一键关闭测试灯光)
This commit is contained in:
zxd 2019-07-09 14:50:43 +08:00
parent 3cdecf8703
commit bb911aa840
4 changed files with 44 additions and 3 deletions

View File

@ -228,6 +228,21 @@ namespace Plane.FormationCreator.ViewModels
}
}
private ICommand _TestFireCommandAsync;
public ICommand TestFireCommandAsync
{
get
{
return _TestFireCommandAsync ?? (_TestFireCommandAsync = new RelayCommand(async () =>
{
int channel = int.Parse(CopterColor);
if (channel >= 0 && channel <= 4)
await commModule.TestFire((short)CopterNum, channel);
}
));
}
}
private List<IMission> CreateLEDMissions(IEnumerable<LEDInfo> LEDInfos)
{
List<IMission> missions = new List<IMission>();

View File

@ -253,6 +253,8 @@ namespace Plane.FormationCreator.ViewModels
}
}
private ICommand _DetectionCommModuleVersion;
public ICommand DetectionCommModuleVersion
{
@ -733,6 +735,25 @@ namespace Plane.FormationCreator.ViewModels
}
}
private ICommand _TurnOffTestLightsCommand;
public ICommand TurnOffTestLightsCommand
{
get
{
return _TurnOffTestLightsCommand ?? (_TurnOffTestLightsCommand = new RelayCommand(async () =>
{
int num = 0;
var o = new { NTF_G_RTLOFF = 1 };
num = await _commModuleManager.SetMultipleParamAsync(
"NTF_G_RTLOFF", "1",
"FS_GCS_ENABLE", "0",
"NTF_G_RTKTEST", "0",
"WAYPOINT_GLED", "0");
Alert.Show($"广播完成! 当前序列号:{num}");
}));
}
}
private string _RTKcomvalue = "COM6";
public string RTKcomvalue
@ -1338,10 +1359,11 @@ namespace Plane.FormationCreator.ViewModels
foreach (LEDInfo ledInfo in LEDInfos)
{
Color color = (Color)ColorConverter.ConvertFromString("#" + ledInfo.LEDRGB);
if (ledInfo.LEDMode == 8) ledInfo.LEDMode = 50;
int ledMode = ledInfo.LEDMode;
if (ledMode == 8) ledMode = 50;
IMission LEDMission = Mission.CreateLEDControlMission(
(int)(ledInfo.Delay * 10),
ledInfo.LEDMode,
ledMode,
ledInfo.LEDRate,
0, //ledInfo.LEDTimes,
color.R,

View File

@ -145,6 +145,7 @@
<TextBox Margin="2,5,5,5" Width="30" Text="{Binding CopterNum}"></TextBox>
<Button Content=" 对频 " Margin="5,5,0,5" Command="{Binding Path=WriteIdCommand}" />
<Button Content="闪灯" Margin="5" Command="{Binding CommDataAsync}"/>
<Button Content="拉烟" Margin="5" Command="{Binding TestFireCommandAsync}"/>
<TextBox Width="80" Text="{Binding CopterColor}"/>
</StackPanel>

View File

@ -86,6 +86,8 @@
Command="{Binding ReportGPSTypeCommand}"/>
<Button Content="统计模块"
Command="{Binding DetectionCommModuleVersion}" />
<Button Content="正式灯光"
Command="{Binding TurnOffTestLightsCommand}" />
<Label Visibility="Collapsed">Lat</Label>
<TextBox Visibility="Collapsed" Text="{Binding LatOffset}" Width="50"/>
<Label Visibility="Collapsed">Lng</Label>
@ -136,7 +138,8 @@
Command="{Binding SendRTKCommand}" />
<Button Content="{Binding Path=NTRIPbtntxt}"
Command="{Binding SendRTCMCommand}" />
Command="{Binding SendRTCMCommand}"
/>
<TextBlock
Margin="5,5,5,5"
Text="{Binding Path=RTKState}"