From bb911aa8405e6f231510cbd4c82d8f35b53087b2 Mon Sep 17 00:00:00 2001 From: zxd Date: Tue, 9 Jul 2019 14:50:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E6=8B=89?= =?UTF-8?q?=E7=83=9F=E7=9A=84=E5=8A=9F=E8=83=BD=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=9A=E5=8F=82=E6=95=B0=E5=90=8C=E6=97=B6=E5=86=99=E5=85=A5?= =?UTF-8?q?=EF=BC=88=E7=94=A8=E4=BA=8E=E4=B8=80=E9=94=AE=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=81=AF=E5=85=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ConnectViewModel.cs | 15 +++++++++++ .../ViewModels/ControlPanelViewModel.cs | 26 +++++++++++++++++-- .../Views/ConnectWindow.xaml | 1 + .../Views/ControlPanelView.xaml | 5 +++- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs index 1af61e9..e7c6207 100644 --- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs @@ -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 CreateLEDMissions(IEnumerable LEDInfos) { List missions = new List(); diff --git a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs index e788203..1b5a811 100644 --- a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs @@ -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, diff --git a/Plane.FormationCreator/Views/ConnectWindow.xaml b/Plane.FormationCreator/Views/ConnectWindow.xaml index b5a8da8..49dd811 100644 --- a/Plane.FormationCreator/Views/ConnectWindow.xaml +++ b/Plane.FormationCreator/Views/ConnectWindow.xaml @@ -145,6 +145,7 @@