Inputs mapped to route bits 80..119, UniCB to bit 120, Emergency stop from bit 96* (not from State), ver. 3.1.1788
This commit is contained in:
@@ -104,6 +104,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
UInt128 routeMask; /// Set in the constructor, bits of outputs that can be controlled by Action.ChangeRoute are set.
|
||||
/// Regulation valve control outputs and diverters cannot be controlled by Action.ChangeRoute
|
||||
/// Depends on the control board configuration
|
||||
UInt128 invInputsMask; /// Typically 0xff000000 0000ffff ffffffff ffffffff, inputs are mapped to route bits 80..119
|
||||
ulong valvesToInvert; /// From configurations of valve and pump components. Inversion is applied when creating
|
||||
/// a message to be sent by serial port
|
||||
UInt128 displayedRoutePlusUI; /// A route displayed on the screen plus the modifications from UI (inversions are not applied)
|
||||
@@ -208,6 +209,10 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
if (cbCfg.RelaysGInstalled) routeMask |= 0xFF000000000000;
|
||||
if (cbCfg.RelaysHInstalled) routeMask |= 0xFF00000000000000;
|
||||
|
||||
invInputsMask = (UInt128)0xffffffffffffffffL;
|
||||
invInputsMask |= (((UInt128)0xffff) << 64);
|
||||
invInputsMask |= (((UInt128)0xff) << 120);
|
||||
|
||||
lastRcvdStMTime = StateMachine.Time; /// To indicate the serial connection state
|
||||
lastSentTime = DateTime.Now;
|
||||
lastReceivedTime = DateTime.Now;
|
||||
@@ -431,21 +436,25 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Map Inputs bits 0..39 to Route bits 80..119
|
||||
///
|
||||
route = (route & invInputsMask) | ((UInt128)Data.Vstupy) << 80;
|
||||
|
||||
///
|
||||
/// Map UniCB indication to Route bit BitNr (default 120)
|
||||
///
|
||||
if (cbCfg.DebugLevel == DebugMode.Normal && (StateMachine.Time - lastRcvdStMTime) >= 5)
|
||||
{
|
||||
/// No connection to control board ... set indicator bit
|
||||
route |= ((UInt128)1) << cbCfg.BitNr;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Handle emergency stop signal
|
||||
///
|
||||
bool emergencyStop = ((State & (UInt64)StatusP.EmgcyStopActive) != 0);
|
||||
///
|
||||
if (emergencyStop)
|
||||
route |= (((UInt128)1) << (cbCfg.BitNr + 1));
|
||||
else
|
||||
route &= ~(((UInt128)1) << (cbCfg.BitNr + 1));
|
||||
bool emergencyStop = ((Data.Vstupy & 0x10000) == 0);
|
||||
///
|
||||
if (emergencyStop && !isEmergencyStop)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
public double MsrdValLimHi { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int BitNr { get { return 80; } } /// Bit-position
|
||||
public int BitNr { get { return 120; } } /// Bit-position
|
||||
[XmlIgnore]
|
||||
public bool Inverted { get { return false; } } /// When true the valve function is inverted: 0 = open, 1 = closed
|
||||
[XmlIgnore]
|
||||
|
||||
Reference in New Issue
Block a user