Modbus modified, UniCB Init. modified, RunDeviceAfter() called in reversed order, ver. 3.1.1597

This commit is contained in:
Milan Hanajik
2021-03-18 16:16:49 +01:00
parent ff70a11cad
commit d7e65ff04b
14 changed files with 293 additions and 157 deletions
+11 -5
View File
@@ -74,9 +74,10 @@ namespace TBF.Rig.Modbus.Ambient.Comet
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
int msrmntTimeStamp;
public Ambient()
{
}
int ticketNumber; /// 1 .. number of devices registered for regular polling
public Ambient() { }
/// <summary>
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -106,6 +107,7 @@ namespace TBF.Rig.Modbus.Ambient.Comet
}
msrmntState = MsrmntState.Busy;
ticketNumber = modbus.RegisterForPolling();
log.FatalFormat("Successfully initialized device {0}", ToString());
}
@@ -143,8 +145,13 @@ namespace TBF.Rig.Modbus.Ambient.Comet
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
}
}
if ((StateMachine.Time % 10) == (ambientCfg.ModbusAddress % 10)) /// Each 10 seconds
public void RunDeviceAfter()
{
if (ambientCfg.DebugLevel != Config.Entities.DebugMode.Simulate &&
ambientCfg.DebugLevel != Config.Entities.DebugMode.FailureDuringOperation &&
modbus.IsMyTurn(ticketNumber))
{
/// Read four registers: 0x31, 0x32, 0x33, 0x34
UInt16 regAddr = 0x0030; /// register addr. = 0x31 (Modbus!)
@@ -163,7 +170,6 @@ namespace TBF.Rig.Modbus.Ambient.Comet
}
}
public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }