Initialization and logging of several TBF.Rig.Modbus components.
This commit is contained in:
@@ -55,16 +55,23 @@ namespace TBF.Rig.Modbus.TempMeter.Groch
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
/// Only TempMeter with Channel == 0 communicates via the parent Modbus component
|
||||
if (Channel == 0)
|
||||
if (DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
modbus = TbfComponents.FindComponent(tempMtrCfg.ParentName) as Common.Modbus;
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
/// Only TempMeter with Channel == 0 communicates via the parent Modbus component
|
||||
if (Channel == 0)
|
||||
{
|
||||
modbus = TbfComponents.FindComponent(tempMtrCfg.ParentName) as Common.Modbus;
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
modbus.ComponentNames[0] = Name;
|
||||
ticketNumber = modbus.RegisterForPolling();
|
||||
modbus.ComponentNames[0] = Name;
|
||||
ticketNumber = modbus.RegisterForPolling();
|
||||
}
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.FatalFormat("{0} simulated: {1}", Name, this);
|
||||
}
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +108,7 @@ namespace TBF.Rig.Modbus.TempMeter.Groch
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (Channel == 0)
|
||||
if (DebugLevel == DebugMode.Normal && Channel == 0)
|
||||
{
|
||||
/// Only TempMeter with Channel == 0 communicates via the parent Modbus component
|
||||
///
|
||||
@@ -145,10 +152,7 @@ namespace TBF.Rig.Modbus.TempMeter.Groch
|
||||
{
|
||||
/// Only TempMeter with Channel == 0 communicates via the parent Modbus component
|
||||
|
||||
if (Channel == 0 &&
|
||||
tempMtrCfg.DebugLevel != DebugMode.Simulate &&
|
||||
tempMtrCfg.DebugLevel != DebugMode.FailureDuringOperation &&
|
||||
modbus.IsMyTurn(ticketNumber))
|
||||
if (DebugLevel == DebugMode.Normal && Channel == 0 && modbus.IsMyTurn(ticketNumber))
|
||||
{
|
||||
modbus.SendMessageGroch(new byte[] { 0x20, 0x20, 0x20, 0x20, 0x10, 2, 1, 3, 6, 0x16 }, Name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user