diff --git a/Correlator/Util/SerialPortClient.cs b/Correlator/Util/SerialPortClient.cs index 69946ab..87a223f 100644 --- a/Correlator/Util/SerialPortClient.cs +++ b/Correlator/Util/SerialPortClient.cs @@ -64,6 +64,7 @@ { BoundSerialPortEvents(); } + #endregion public string[] GetPorts() @@ -146,6 +147,7 @@ if (!_serialPort.IsOpen) _serialPort.Open(); _serialPort.Write(text); } + #endregion /// @@ -154,10 +156,7 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); - } + CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); } private void BoundSerialPortEvents() diff --git a/Correlator/Util/SerialPortClient.cs b/Correlator/Util/SerialPortClient.cs index 69946ab..87a223f 100644 --- a/Correlator/Util/SerialPortClient.cs +++ b/Correlator/Util/SerialPortClient.cs @@ -64,6 +64,7 @@ { BoundSerialPortEvents(); } + #endregion public string[] GetPorts() @@ -146,6 +147,7 @@ if (!_serialPort.IsOpen) _serialPort.Open(); _serialPort.Write(text); } + #endregion /// @@ -154,10 +156,7 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); - } + CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); } private void BoundSerialPortEvents() diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index c4b4ccd..1a8d528 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -398,11 +398,8 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(Sp, devId); - Sp.Write("ATA" + Environment.NewLine); - } + CommandSender.SendCellAndStatusCollectCmd(Sp, devId); + Sp.Write("ATA" + Environment.NewLine); } } } \ No newline at end of file diff --git a/Correlator/Util/SerialPortClient.cs b/Correlator/Util/SerialPortClient.cs index 69946ab..87a223f 100644 --- a/Correlator/Util/SerialPortClient.cs +++ b/Correlator/Util/SerialPortClient.cs @@ -64,6 +64,7 @@ { BoundSerialPortEvents(); } + #endregion public string[] GetPorts() @@ -146,6 +147,7 @@ if (!_serialPort.IsOpen) _serialPort.Open(); _serialPort.Write(text); } + #endregion /// @@ -154,10 +156,7 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); - } + CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); } private void BoundSerialPortEvents() diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index c4b4ccd..1a8d528 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -398,11 +398,8 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(Sp, devId); - Sp.Write("ATA" + Environment.NewLine); - } + CommandSender.SendCellAndStatusCollectCmd(Sp, devId); + Sp.Write("ATA" + Environment.NewLine); } } } \ No newline at end of file diff --git a/Correlator/View/MainWindow.xaml.cs b/Correlator/View/MainWindow.xaml.cs index 5db0f9f..5dbefd4 100644 --- a/Correlator/View/MainWindow.xaml.cs +++ b/Correlator/View/MainWindow.xaml.cs @@ -22,6 +22,7 @@ { Interval = new TimeSpan(0, 0, 7) }; + public MainWindow() { InitializeComponent(); @@ -76,12 +77,27 @@ if (SerialPortManager.Get.Sp.IsOpen) { - _devId = (byte)(_devId == 0x02 ? 0x01 : 0x02); //实时显示信号电量 - SerialPortManager.Get.ShowSignal(_devId); + if (!FlowStatus.RedSensorIsEnable && !FlowStatus.BlueSensorIsEnable) + { + _devId = (byte)(_devId == 0x02 ? 0x01 : 0x02); + SerialPortManager.Get.ShowSignal(_devId); + } + else + { + if (!FlowStatus.RedSensorIsEnable) + { + SerialPortManager.Get.ShowSignal(0x01); + } + + if (!FlowStatus.BlueSensorIsEnable) + { + SerialPortManager.Get.ShowSignal(0x02); + } + } } } - private byte _devId = 0x01; + private byte _devId = 0x02; } } \ No newline at end of file diff --git a/Correlator/Util/SerialPortClient.cs b/Correlator/Util/SerialPortClient.cs index 69946ab..87a223f 100644 --- a/Correlator/Util/SerialPortClient.cs +++ b/Correlator/Util/SerialPortClient.cs @@ -64,6 +64,7 @@ { BoundSerialPortEvents(); } + #endregion public string[] GetPorts() @@ -146,6 +147,7 @@ if (!_serialPort.IsOpen) _serialPort.Open(); _serialPort.Write(text); } + #endregion /// @@ -154,10 +156,7 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); - } + CommandSender.SendCellAndStatusCollectCmd(_serialPort, devId); } private void BoundSerialPortEvents() diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index c4b4ccd..1a8d528 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -398,11 +398,8 @@ /// public void ShowSignal(byte devId) { - if (!FlowStatus.CanCollectData) - { - CommandSender.SendCellAndStatusCollectCmd(Sp, devId); - Sp.Write("ATA" + Environment.NewLine); - } + CommandSender.SendCellAndStatusCollectCmd(Sp, devId); + Sp.Write("ATA" + Environment.NewLine); } } } \ No newline at end of file diff --git a/Correlator/View/MainWindow.xaml.cs b/Correlator/View/MainWindow.xaml.cs index 5db0f9f..5dbefd4 100644 --- a/Correlator/View/MainWindow.xaml.cs +++ b/Correlator/View/MainWindow.xaml.cs @@ -22,6 +22,7 @@ { Interval = new TimeSpan(0, 0, 7) }; + public MainWindow() { InitializeComponent(); @@ -76,12 +77,27 @@ if (SerialPortManager.Get.Sp.IsOpen) { - _devId = (byte)(_devId == 0x02 ? 0x01 : 0x02); //实时显示信号电量 - SerialPortManager.Get.ShowSignal(_devId); + if (!FlowStatus.RedSensorIsEnable && !FlowStatus.BlueSensorIsEnable) + { + _devId = (byte)(_devId == 0x02 ? 0x01 : 0x02); + SerialPortManager.Get.ShowSignal(_devId); + } + else + { + if (!FlowStatus.RedSensorIsEnable) + { + SerialPortManager.Get.ShowSignal(0x01); + } + + if (!FlowStatus.BlueSensorIsEnable) + { + SerialPortManager.Get.ShowSignal(0x02); + } + } } } - private byte _devId = 0x01; + private byte _devId = 0x02; } } \ No newline at end of file diff --git a/Correlator/ViewModel/HomePageProViewModel.cs b/Correlator/ViewModel/HomePageProViewModel.cs index a550689..697a565 100644 --- a/Correlator/ViewModel/HomePageProViewModel.cs +++ b/Correlator/ViewModel/HomePageProViewModel.cs @@ -766,7 +766,6 @@ //每次计算之前都需要判断是否已经完成之前的计算,然后清空上一次的计算数据 ResetParam(); - //信号收发器正常之后就可以下发收集数据的指令了 FlowStatus.CanCollectData = true; //开始数据采集 if (FlowStatus.IsHydrophone) @@ -833,6 +832,8 @@ private bool CalculateData(CorrelatorDataModel dataModel) { DialogHub.Get.ShowLoadingDialog(_homePageWindow, "样品数据计算中,请稍后..."); + //开始计算就不收集收据了 + FlowStatus.CanCollectData = false; var array = _correlator.locating(11, (MWNumericArray)dataModel.LeftDeviceDataArray, (MWNumericArray)dataModel.RightDeviceDataArray, Constant.SamplingRate, @@ -868,8 +869,8 @@ _runningTimer.Stop(); StartButtonEnabled = true; - //开始计算就不收集收据了 - FlowStatus.CanCollectData = false; + FlowStatus.RedSensorIsEnable = false; + FlowStatus.BlueSensorIsEnable = false; DialogHub.Get.DismissLoadingDialog(); return true; }