Uni.RegValveAnalog : Initial implementation for UNI, ver. 3.5.2015
This commit is contained in:
@@ -13,7 +13,6 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(OutputMessage));
|
||||
|
||||
public const int PayloadLen = 38;
|
||||
public const byte MessageCode = (byte)' ';
|
||||
|
||||
|
||||
static Action arguments = new Action();
|
||||
@@ -43,7 +42,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
message[0] = Const.STX;
|
||||
message[1] = 1; /// Control board addres
|
||||
message[2] = (byte)PayloadLen; /// Payload length
|
||||
message[3] = MessageCode;
|
||||
message[3] = (byte)' '; /// Message code
|
||||
|
||||
/// Command
|
||||
message[4] = GetCommand(action);
|
||||
@@ -82,7 +81,8 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
message[26] = 0;
|
||||
|
||||
/// Regulation valve
|
||||
message[27] = (action.RegVId < 0) ? (byte)0 : (byte)(action.RegVId | (int)action.RegVMode);
|
||||
message[27] = (action.RegVId < 0 || (action.RegVId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx && action.RegVMode == RegValveMode.TargetFrequency))
|
||||
? (byte)0 : (byte)(action.RegVId | (int)action.RegVMode);
|
||||
message[28] = (byte)(action.RVMovePar1 & 0xFF);
|
||||
message[29] = (byte)((action.RVMovePar1 >> 8) & 0xFF);
|
||||
message[30] = (byte)(action.RVMovePar2 & 0xFF);
|
||||
@@ -90,12 +90,12 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
message[32] = GetRVStopParam(action);
|
||||
|
||||
/// DA1
|
||||
message[33] = 0; /// PrudParL
|
||||
message[34] = 0; /// PrudParH
|
||||
message[33] = (byte)(arguments.InitDacVal & 0xFF);
|
||||
message[34] = (byte)((arguments.InitDacVal >> 8) & 0xFF);
|
||||
|
||||
message[35] = (byte)Math.Max(1, Math.Min(255, arguments.PID)); /// PIDRV
|
||||
message[36] = 0; // (byte)Math.Max(4, Math.Min(255, action.TolerRV)); /// TolerRV (4..20 mA reg.valve only)
|
||||
message[37] = (byte)Math.Max(0, Math.Min(255, arguments.StabTime)); /// StabRV
|
||||
message[35] = (byte)Math.Max(1, Math.Min(255, arguments.PID)); /// PIDRV
|
||||
message[36] = (byte)Math.Max(4, Math.Min(255, action.TolerRV)); /// TolerRV (4..20 mA reg.valve only)
|
||||
message[37] = (byte)Math.Max(0, Math.Min(255, arguments.StabTime)); /// StabRV
|
||||
message[38] = (byte)((arguments.DivThreshold >> 2) & 0xFF);
|
||||
|
||||
message[39] = 0;
|
||||
@@ -144,11 +144,19 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
return (byte)StopDevs.All;
|
||||
}
|
||||
|
||||
static byte GetRVStopParam(Action action)
|
||||
static byte GetRVStopParam(Action a)
|
||||
{
|
||||
if (action.IsStop()) return (byte)0x20;
|
||||
if ((action.ActionId & ActionID.RegVlvStop) != 0) return (byte)0x20;
|
||||
return (byte)0;
|
||||
if (a.IsStop() || (a.ActionId & ActionID.RegVlvStop) != 0)
|
||||
{
|
||||
return (byte)0x20;
|
||||
}
|
||||
|
||||
if ((a.ActionId & ActionID.SetFlow) != 0 && a.RegVId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
|
||||
{
|
||||
return (byte)0x42;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user