From 92a56a247f54f33edb5995e87cc72c06de06dc13 Mon Sep 17 00:00:00 2001 From: xu Date: Sun, 30 Jun 2024 11:18:27 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E8=B0=83=E6=95=B4=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=85=B3=E9=94=AE=E6=8C=87=E4=BB=A4=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=88=B0=E5=B9=BF=E6=92=AD=E9=80=9A=E9=81=93?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E7=95=8C=E9=9D=A2=EF=BC=8CRTCM=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=8F=8C=E9=80=9A=E9=81=93=E5=8F=91=E9=80=81=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E8=A6=81=E6=89=93=E5=BC=80=E5=B9=BF=E6=92=AD=E9=80=9A?= =?UTF-8?q?=E9=81=93=EF=BC=8Crtcm=E8=87=AA=E5=8A=A8=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=B9=BF=E6=92=AD=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加紧急返航的注释,要不不清除功能怎么用 /// 紧急返航:计算当前图案中心点,起飞图案中心点,图案距离起飞图案中心点最近距离 /// 条件:任务已经开始,且飞行器已经飞行 /// 可用于模拟和实际飞行, /// 1首先需要导入最后的飞行任务文件, /// 2实际飞机需要执行解锁和开始任务 /// 3模拟任务需要开始任务并且暂停任务才能计算 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- .../Formation/RtcmManager.cs | 30 ++++--------------- .../ViewModels/ConnectViewModel.cs | 17 ++++++----- .../ViewModels/ControlPanelViewModel.cs | 10 ++++++- .../ViewModels/RtcmInfoViewModel.cs | 26 ++++++++++++++-- .../Views/ConnectWindow.xaml | 2 +- .../Views/RtcmInfoView.xaml | 13 +++++--- 6 files changed, 58 insertions(+), 40 deletions(-) diff --git a/Plane.FormationCreator/Formation/RtcmManager.cs b/Plane.FormationCreator/Formation/RtcmManager.cs index d2a3ff2..c66f8dd 100644 --- a/Plane.FormationCreator/Formation/RtcmManager.cs +++ b/Plane.FormationCreator/Formation/RtcmManager.cs @@ -101,33 +101,13 @@ namespace Plane.FormationCreator.Formation return typename; } - private void SetRTKStatestr() - { - string rtksstr= ""; - // ResendToCom - if (Rtcmthreadrun) - { - rtksstr = "RTK发送中 "; - - if (SmallRtcmData) - rtksstr += ",低带宽模式 "; - if (ResendToCom) - rtksstr += ",双通道发送 "; - rtksstr += "..."; - } - else - rtksstr = "RTK未发送"; - - ControlPanelVM.RTKState = rtksstr; - - } - public bool Rtcmthreadrun { get { return _rtcmthreadrun; } set { Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value); - SetRTKStatestr(); + var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance(); + _RtcmInfoViewModel.SetRTKStatestr(); } } @@ -137,7 +117,8 @@ namespace Plane.FormationCreator.Formation set { Set(nameof(SmallRtcmData), ref _smallrtcmdata, value); - SetRTKStatestr(); + var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance(); + _RtcmInfoViewModel.SetRTKStatestr(); } } @@ -234,7 +215,8 @@ namespace Plane.FormationCreator.Formation get { return _sesendtocom; } set { Set(nameof(ResendToCom), ref _sesendtocom, value); - SetRTKStatestr(); + var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance(); + _RtcmInfoViewModel.SetRTKStatestr(); } } diff --git a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs index 961c927..e570af4 100644 --- a/Plane.FormationCreator/ViewModels/ConnectViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ConnectViewModel.cs @@ -114,26 +114,28 @@ namespace Plane.FormationCreator.ViewModels { if (_commModuleManager.Recomisopen) { - //当前是否使用了广播端口 - if (_rtcmInfoViewModel.ResendToComMK) + //关闭广播端口 + //正在发送rtcm数据并且使用了广播端口 + if (_rtcmInfoViewModel.RtcmManager.Rtcmthreadrun&& _rtcmInfoViewModel.ResendToComMK) { - if (Alert.Show("将同时关闭双通道发送RTK数据,继续吗?", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning) + if (Alert.Show("正在使用广播端口发送RTCM数据,关闭后广播端口将停止发送,继续吗?", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { - _rtcmInfoViewModel.ResendToComMK = false; + // _rtcmInfoViewModel.ResendToComMK = false; } else { return; } } - _commModuleManager.CloseResendRtcmserial(); + //关闭同时清除广播端口,这样就不会重试打开 + _commModuleManager.CloseResendRtcmserial(true); btnBoardPortStr = "打开广播端口"; BoardPortStatusStr = _commModuleManager.BoardPortStatusStr; Message.BoardOpen(false); } else - { + { //打开广播端口 if ((SerialPortResend != null)) { @@ -155,6 +157,7 @@ namespace Plane.FormationCreator.ViewModels return; } } + _rtcmInfoViewModel.SetRTKStatestr(); } )); } @@ -231,7 +234,7 @@ namespace Plane.FormationCreator.ViewModels set { Set(nameof(CopterColor), ref _CopterColor, value); } } - private string _BoardPortStatusStr = "端口未打开"; + private string _BoardPortStatusStr = "广播端口未打开"; public string BoardPortStatusStr { get { return _BoardPortStatusStr; } diff --git a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs index 7b5d56d..48e0849 100644 --- a/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ControlPanelViewModel.cs @@ -409,6 +409,14 @@ namespace Plane.FormationCreator.ViewModels })); } } + /// + /// 紧急返航:计算当前图案中心点,起飞图案中心点,图案距离起飞图案中心点最近距离 + /// 条件:任务已经开始,且飞行器已经飞行 + /// 可用于模拟和实际飞行, + /// 1首先需要导入最后的飞行任务文件, + /// 2实际飞机需要执行解锁和开始任务 + /// 3模拟任务需要开始任务并且暂停任务才能计算 + /// private ICommand _EmergencyRetCommand; public ICommand EmergencyRetCommand { @@ -427,7 +435,7 @@ namespace Plane.FormationCreator.ViewModels if ((_flightTaskManager.TaskState_real == TasksStatus.Stop) &&((_flightTaskManager.IsPaused ?? false) == false)) { - Alert.Show("先暂停任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); + Alert.Show("没有开始真实任务,模拟紧急返航需要先暂停模拟任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } //if (Alert.Show("您确定要紧急返航吗?紧急返航可能导致飞行器碰撞!!!!", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning) diff --git a/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs b/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs index 1334c81..e66f11d 100644 --- a/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs +++ b/Plane.FormationCreator/ViewModels/RtcmInfoViewModel.cs @@ -1,5 +1,6 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using Microsoft.Practices.ServiceLocation; using Plane.CommunicationManagement; using Plane.FormationCreator.Formation; using Plane.Windows.Messages; @@ -31,7 +32,27 @@ namespace Plane.FormationCreator.ViewModels return _commModuleManager.BoardPortStatusStr; } } + private ControlPanelViewModel ControlPanelVM = ServiceLocator.Current.GetInstance(); + public void SetRTKStatestr() + { + string rtksstr = ""; + // ResendToCom + if (_rtcmManager.Rtcmthreadrun) + { + rtksstr = "RTK发送中 "; + if (_rtcmManager.SmallRtcmData) + rtksstr += ",低带宽模式 "; + if (_rtcmManager.ResendToCom && _commModuleManager.Recomisopen) + rtksstr += ",双通道模式 "; + rtksstr += "..."; + } + else + rtksstr = "RTK未发送"; + + ControlPanelVM.RTKState = rtksstr; + + } private string _serialPortsSelectdValue; @@ -56,7 +77,7 @@ namespace Plane.FormationCreator.ViewModels } } - private bool _resendtocommk; + private bool _resendtocommk=true; public bool ResendToComMK { get { return _resendtocommk; } @@ -67,8 +88,7 @@ namespace Plane.FormationCreator.ViewModels { //发送 if (!_commModuleManager.Recomisopen) { - Alert.Show($"请在设置里面打开广播端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information); - return; + Alert.Show($"请先在设置里面打开广播端口,否则无法发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } } diff --git a/Plane.FormationCreator/Views/ConnectWindow.xaml b/Plane.FormationCreator/Views/ConnectWindow.xaml index 5f60a4b..81c3715 100644 --- a/Plane.FormationCreator/Views/ConnectWindow.xaml +++ b/Plane.FormationCreator/Views/ConnectWindow.xaml @@ -70,7 +70,7 @@ ItemsSource="{Binding serialRePorts, Mode=OneWay}" SelectedValue="{Binding SerialPortResend}" DropDownOpened="ComboBox_DropDownOpened"/> - + diff --git a/Plane.FormationCreator/Views/RtcmInfoView.xaml b/Plane.FormationCreator/Views/RtcmInfoView.xaml index b9b2928..3233c63 100644 --- a/Plane.FormationCreator/Views/RtcmInfoView.xaml +++ b/Plane.FormationCreator/Views/RtcmInfoView.xaml @@ -26,15 +26,20 @@