Browse Source

hv update

sangwq 2 years ago
parent
commit
155e2ecfe1
2 changed files with 9 additions and 2 deletions
  1. 8 2
      Venus/Venus_RT/Devices/ESC5HighVoltage.cs
  2. 1 0
      Venus/Venus_RT/Devices/JetPM.cs

+ 8 - 2
Venus/Venus_RT/Devices/ESC5HighVoltage.cs

@@ -26,6 +26,8 @@ namespace Venus_RT.Devices
         public int CenterTapVoltage { get; private set; }
         public int CenterTapVoltage { get; private set; }
         public int PositiveOutputCurrent { get; private set; }
         public int PositiveOutputCurrent { get; private set; }
         public int NegativeOutputCurrent { get; private set; }
         public int NegativeOutputCurrent { get; private set; }
+
+        public bool IsOn { get; private set; }
         public enum Operation
         public enum Operation
         {
         {
             Attention,
             Attention,
@@ -85,9 +87,10 @@ namespace Venus_RT.Devices
         };
         };
 
 
         private readonly int _readInterval = 1000;
         private readonly int _readInterval = 1000;
-        private readonly int _readTimeout = 2000;
+        private readonly int _readTimeout = 5000;
         private readonly AsyncSerialPort _serial;
         private readonly AsyncSerialPort _serial;
         private Stopwatch _queryWatch = new Stopwatch();
         private Stopwatch _queryWatch = new Stopwatch();
+        private int _opFlag = 0;
 
 
         private Operation _lastReadCommand = Operation.Invalid;
         private Operation _lastReadCommand = Operation.Invalid;
         private string _lastAlarmString = string.Empty;
         private string _lastAlarmString = string.Empty;
@@ -124,7 +127,7 @@ namespace Venus_RT.Devices
         {
         {
             if ((_queryWatch.ElapsedMilliseconds > _readInterval && _lastReadCommand == Operation.Invalid) || _queryWatch.ElapsedMilliseconds > _readTimeout)
             if ((_queryWatch.ElapsedMilliseconds > _readInterval && _lastReadCommand == Operation.Invalid) || _queryWatch.ElapsedMilliseconds > _readTimeout)
             {
             {
-                SendCommand(Operation.ReadOutputVoltage);
+                SendCommand(_opFlag++ % 2 == 0 ? Operation.ReadOutputVoltage : Operation.ReadStatus);
                 _queryWatch.Restart();
                 _queryWatch.Restart();
             }
             }
         }
         }
@@ -176,6 +179,9 @@ namespace Venus_RT.Devices
                         case Operation.ReadPositiveOutputCurrent:
                         case Operation.ReadPositiveOutputCurrent:
                             PositiveOutputCurrent = nData;
                             PositiveOutputCurrent = nData;
                             break;
                             break;
+                        case Operation.ReadStatus:
+                            IsOn = (nData & 0x04) != 0;
+                            break;
                     }
                     }
                 }
                 }
                 else
                 else

+ 1 - 0
Venus/Venus_RT/Devices/JetPM.cs

@@ -185,6 +185,7 @@ namespace Venus_RT.Devices
         public double ESCHePressure => _pressureController.ESCHeGauge.Value;
         public double ESCHePressure => _pressureController.ESCHeGauge.Value;
 
 
         public int ESCOutputVoltage => _ESCHV.OutputVoltage;
         public int ESCOutputVoltage => _ESCHV.OutputVoltage;
+        public bool IsHVOn => _ESCHV.IsOn;
 
 
         public float CoolantInletTempFB => _Chiller.CoolantInletTcFeedback;
         public float CoolantInletTempFB => _Chiller.CoolantInletTcFeedback;
         public float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;
         public float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;