Modbus modified, UniCB Init. modified, RunDeviceAfter() called in reversed order, ver. 3.1.1597
This commit is contained in:
@@ -25,6 +25,8 @@ namespace TBF.Rig.Modbus.PressureMeter.Meret
|
||||
public double MeasuredVal { get { return receivedPressure; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
|
||||
int ticketNumber; /// 1 .. number of devices registered for regular polling
|
||||
|
||||
|
||||
public PressureMeter() { }
|
||||
|
||||
@@ -42,7 +44,10 @@ namespace TBF.Rig.Modbus.PressureMeter.Meret
|
||||
///
|
||||
/// IDevice interface
|
||||
///
|
||||
public void Initialize() { }
|
||||
public void Initialize()
|
||||
{
|
||||
ticketNumber = modbus.RegisterForPolling();
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
@@ -71,8 +76,13 @@ namespace TBF.Rig.Modbus.PressureMeter.Meret
|
||||
log.WarnFormat("Pressure: {0}={1}bar", Name, receivedPressure.ToString("F3"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((StateMachine.Time % Constants.ModbusPollPeriod) == (pressureMtrCfg.ModbusAddress % Constants.ModbusPollPeriod)) /// Each 'ModbusDevices' seconds
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (pressureMtrCfg.DebugLevel != Config.Entities.DebugMode.Simulate &&
|
||||
pressureMtrCfg.DebugLevel != Config.Entities.DebugMode.FailureDuringOperation &&
|
||||
modbus.IsMyTurn(ticketNumber))
|
||||
{
|
||||
const byte Function = 4; /// Read input registers
|
||||
const ushort Address = 0; /// Pressure
|
||||
@@ -80,7 +90,6 @@ namespace TBF.Rig.Modbus.PressureMeter.Meret
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user