[feat] 调整界面,关键指令同时发送到广播通道

调整界面,RTCM默认双通道发送,只要打开广播通道,rtcm自动同时通过广播发送

增加紧急返航的注释,要不不清除功能怎么用
        /// 紧急返航:计算当前图案中心点,起飞图案中心点,图案距离起飞图案中心点最近距离
        /// 条件:任务已经开始,且飞行器已经飞行
        /// 可用于模拟和实际飞行,
        /// 1首先需要导入最后的飞行任务文件,
        /// 2实际飞机需要执行解锁和开始任务
        /// 3模拟任务需要开始任务并且暂停任务才能计算

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
xu 2024-06-30 11:18:27 +08:00
parent a9cf0fdc8a
commit 92a56a247f
6 changed files with 58 additions and 40 deletions

View File

@ -101,33 +101,13 @@ namespace Plane.FormationCreator.Formation
return typename; 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 public bool Rtcmthreadrun
{ {
get { return _rtcmthreadrun; } get { return _rtcmthreadrun; }
set { set {
Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value); Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value);
SetRTKStatestr(); var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance<RtcmInfoViewModel>();
_RtcmInfoViewModel.SetRTKStatestr();
} }
} }
@ -137,7 +117,8 @@ namespace Plane.FormationCreator.Formation
set set
{ {
Set(nameof(SmallRtcmData), ref _smallrtcmdata, value); Set(nameof(SmallRtcmData), ref _smallrtcmdata, value);
SetRTKStatestr(); var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance<RtcmInfoViewModel>();
_RtcmInfoViewModel.SetRTKStatestr();
} }
} }
@ -234,7 +215,8 @@ namespace Plane.FormationCreator.Formation
get { return _sesendtocom; } get { return _sesendtocom; }
set { set {
Set(nameof(ResendToCom), ref _sesendtocom, value); Set(nameof(ResendToCom), ref _sesendtocom, value);
SetRTKStatestr(); var _RtcmInfoViewModel = ServiceLocator.Current.GetInstance<RtcmInfoViewModel>();
_RtcmInfoViewModel.SetRTKStatestr();
} }
} }

View File

@ -114,26 +114,28 @@ namespace Plane.FormationCreator.ViewModels
{ {
if (_commModuleManager.Recomisopen) 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) == MessageBoxResult.OK)
{ {
_rtcmInfoViewModel.ResendToComMK = false; // _rtcmInfoViewModel.ResendToComMK = false;
} }
else else
{ {
return; return;
} }
} }
_commModuleManager.CloseResendRtcmserial(); //关闭同时清除广播端口,这样就不会重试打开
_commModuleManager.CloseResendRtcmserial(true);
btnBoardPortStr = "打开广播端口"; btnBoardPortStr = "打开广播端口";
BoardPortStatusStr = _commModuleManager.BoardPortStatusStr; BoardPortStatusStr = _commModuleManager.BoardPortStatusStr;
Message.BoardOpen(false); Message.BoardOpen(false);
} }
else else
{ { //打开广播端口
if ((SerialPortResend != null)) if ((SerialPortResend != null))
{ {
@ -155,6 +157,7 @@ namespace Plane.FormationCreator.ViewModels
return; return;
} }
} }
_rtcmInfoViewModel.SetRTKStatestr();
} }
)); ));
} }
@ -231,7 +234,7 @@ namespace Plane.FormationCreator.ViewModels
set { Set(nameof(CopterColor), ref _CopterColor, value); } set { Set(nameof(CopterColor), ref _CopterColor, value); }
} }
private string _BoardPortStatusStr = "端口未打开"; private string _BoardPortStatusStr = "广播端口未打开";
public string BoardPortStatusStr public string BoardPortStatusStr
{ {
get { return _BoardPortStatusStr; } get { return _BoardPortStatusStr; }

View File

@ -409,6 +409,14 @@ namespace Plane.FormationCreator.ViewModels
})); }));
} }
} }
/// <summary>
/// 紧急返航:计算当前图案中心点,起飞图案中心点,图案距离起飞图案中心点最近距离
/// 条件:任务已经开始,且飞行器已经飞行
/// 可用于模拟和实际飞行,
/// 1首先需要导入最后的飞行任务文件
/// 2实际飞机需要执行解锁和开始任务
/// 3模拟任务需要开始任务并且暂停任务才能计算
/// </summary>
private ICommand _EmergencyRetCommand; private ICommand _EmergencyRetCommand;
public ICommand EmergencyRetCommand public ICommand EmergencyRetCommand
{ {
@ -427,7 +435,7 @@ namespace Plane.FormationCreator.ViewModels
if ((_flightTaskManager.TaskState_real == TasksStatus.Stop) if ((_flightTaskManager.TaskState_real == TasksStatus.Stop)
&&((_flightTaskManager.IsPaused ?? false) == false)) &&((_flightTaskManager.IsPaused ?? false) == false))
{ {
Alert.Show("先暂停任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); Alert.Show("没有开始真实任务,模拟紧急返航需要先暂停模拟任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return; return;
} }
//if (Alert.Show("您确定要紧急返航吗?紧急返航可能导致飞行器碰撞!!!!", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning) //if (Alert.Show("您确定要紧急返航吗?紧急返航可能导致飞行器碰撞!!!!", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning)

View File

@ -1,5 +1,6 @@
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using Microsoft.Practices.ServiceLocation;
using Plane.CommunicationManagement; using Plane.CommunicationManagement;
using Plane.FormationCreator.Formation; using Plane.FormationCreator.Formation;
using Plane.Windows.Messages; using Plane.Windows.Messages;
@ -31,7 +32,27 @@ namespace Plane.FormationCreator.ViewModels
return _commModuleManager.BoardPortStatusStr; return _commModuleManager.BoardPortStatusStr;
} }
} }
private ControlPanelViewModel ControlPanelVM = ServiceLocator.Current.GetInstance<ControlPanelViewModel>();
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; private string _serialPortsSelectdValue;
@ -56,7 +77,7 @@ namespace Plane.FormationCreator.ViewModels
} }
} }
private bool _resendtocommk; private bool _resendtocommk=true;
public bool ResendToComMK public bool ResendToComMK
{ {
get { return _resendtocommk; } get { return _resendtocommk; }
@ -67,8 +88,7 @@ namespace Plane.FormationCreator.ViewModels
{ //发送 { //发送
if (!_commModuleManager.Recomisopen) if (!_commModuleManager.Recomisopen)
{ {
Alert.Show($"请在设置里面打开广播端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information); Alert.Show($"请先在设置里面打开广播端口,否则无法发送", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
} }
} }

View File

@ -70,7 +70,7 @@
ItemsSource="{Binding serialRePorts, Mode=OneWay}" ItemsSource="{Binding serialRePorts, Mode=OneWay}"
SelectedValue="{Binding SerialPortResend}" SelectedValue="{Binding SerialPortResend}"
DropDownOpened="ComboBox_DropDownOpened"/> DropDownOpened="ComboBox_DropDownOpened"/>
<TextBlock Margin="5" VerticalAlignment="Center" Text="{Binding BoardPortStatusStr}" /> <TextBlock Margin="10,5,5,5" VerticalAlignment="Center" Text="{Binding BoardPortStatusStr}" />
</StackPanel> </StackPanel>

View File

@ -26,15 +26,20 @@
<Label Margin="6,6,0,6" Height="28" Content="卫星数:"/> <Label Margin="6,6,0,6" Height="28" Content="卫星数:"/>
<Label Margin="0,6,6,6" Height="28" Content="{Binding RtcmManager.rtcmInfoList.Count,UpdateSourceTrigger=PropertyChanged}"></Label> <Label Margin="0,6,6,6" Height="28" Content="{Binding RtcmManager.rtcmInfoList.Count,UpdateSourceTrigger=PropertyChanged}"></Label>
</StackPanel> </StackPanel>
<StackPanel Margin="6,0,0,6" Orientation="Horizontal"> <StackPanel Margin="6,0,0,2" Orientation="Horizontal">
<CheckBox x:Name="checkBox" Content="双通道发送" <CheckBox x:Name="checkBox" Content="双通道模式 (同时发到广播端口)"
Margin="4,5,5,0" Width="130" Margin="4,5,5,0" Width="190"
IsChecked="{Binding ResendToComMK}"/> IsChecked="{Binding ResendToComMK}"/>
<TextBlock Margin="0,4,0,0" Text="{Binding BoardPortsStatus}"/>
<CheckBox x:Name="cBsmalldata" Content="低带宽模式" <CheckBox x:Name="cBsmalldata" Content="低带宽模式"
Margin="20,5,5,0" Width="95" Margin="20,5,5,0" Width="95"
IsChecked="{Binding SmalldataMK}"/> IsChecked="{Binding SmalldataMK}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="6,0,0,2" Orientation="Horizontal">
<TextBlock Margin="23,1,0,0" Text="{Binding BoardPortsStatus}"/>
</StackPanel>
</StackPanel> </StackPanel>