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