Bug fix in StateMachine.InitializeDevices( ), Modbus.RegTelegramsPerSecond = 3, MaxTelegramsPerSecond = 5, ver. 3.1.1601

This commit is contained in:
Milan Hanajik
2021-04-06 10:24:42 +02:00
parent dd24c8b073
commit 6d9a7e2385
4 changed files with 14 additions and 20 deletions
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("3.1.1600.0")] [assembly: AssemblyVersion("3.1.1601.0")]
[assembly: AssemblyFileVersion("3.1.1600.0")] [assembly: AssemblyFileVersion("3.1.1601.0")]
+3 -2
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2021 Sensus Metering Systems /// Copyright (c) 2015-2021 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -22,7 +22,8 @@ namespace TBF.Rig.Modbus.Common
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(-1)); } public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(-1)); }
const int MaxTelegramsPerSecond = 5; /// Max. number of telegrams to be sent per second (100 ms for each telegram) const int MaxTelegramsPerSecond = 5; /// Max. number of telegrams to be sent per second (100 ms for each telegram)
const int RegTelegramsPerSecond = 2; /// Number of registered polling telegrams per second const int RegTelegramsPerSecond = 3; /// Number of registered polling telegrams per second
const int MinTelegramLen = 4; const int MinTelegramLen = 4;
private readonly ModbusCfg modbusCfg; private readonly ModbusCfg modbusCfg;
+8 -15
View File
@@ -294,12 +294,10 @@ namespace TBF.Rig
} }
public static string CurrentlyInitializedDeviceName; public static string CurrentlyInitializedComponentName;
/// ///
public static string InitializeDevices() public static string InitializeDevices()
{ {
CurrentlyInitializedDeviceName = "-";
bool anyComponentIsInSimulMode = false; bool anyComponentIsInSimulMode = false;
StringBuilder inSimulMode = new StringBuilder(); StringBuilder inSimulMode = new StringBuilder();
@@ -312,22 +310,17 @@ namespace TBF.Rig
anyComponentIsInSimulMode = true; anyComponentIsInSimulMode = true;
} }
IDevice device = cmpnt as IDevice; if (cmpnt is IDevice)
if (device != null)
{ {
CurrentlyInitializedDeviceName = device.Name; devices.Add(cmpnt as IDevice); /// Only components that were initialized are added
UiBridge.Bridge.OnActivity(null, device.Name); /// Info UiBridge.Bridge.OnActivity(null, cmpnt.Name); /// Info
device.Initialize();
devices.Add(device); /// Only components that were initialized are added
}
else
{
CurrentlyInitializedDeviceName = device.Name;
cmpnt.Initialize();
} }
CurrentlyInitializedComponentName = cmpnt.Name;
cmpnt.Initialize();
} }
CurrentlyInitializedDeviceName = "---"; CurrentlyInitializedComponentName = "---";
/// ///
/// (1) Propagate debug levels from parents to children when necessary /// (1) Propagate debug levels from parents to children when necessary
+1 -1
View File
@@ -295,7 +295,7 @@ namespace TBF.UI
formThread.Join(); formThread.Join();
string errMsg = string.Format(Strings.Failed_to_initialize_device_0_1_2, string errMsg = string.Format(Strings.Failed_to_initialize_device_0_1_2,
Rig.StateMachine.CurrentlyInitializedDeviceName, Rig.StateMachine.CurrentlyInitializedComponentName,
Environment.NewLine, Environment.NewLine,
exc.Message); exc.Message);
log.Fatal(errMsg); log.Fatal(errMsg);