From 8587ad9d3d84a47c7ae199353f1715237b2e6c5a Mon Sep 17 00:00:00 2001 From: nikzori Date: Wed, 2 Apr 2025 12:40:39 +0300 Subject: [PATCH] added line break polling --- Datasheet.cs | 14 ++++++++++++++ Gidrolock Modbus Configurator.csproj | 2 +- Main.cs | 22 ++++++++++++++++++++-- Modbus.cs | 2 +- Model.cs | 2 +- Properties/AssemblyInfo.cs | 4 ++-- Properties/Resources.Designer.cs | 4 ++-- Properties/Settings.Designer.cs | 2 +- 8 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Datasheet.cs b/Datasheet.cs index b8d64a0..81ef2c6 100644 --- a/Datasheet.cs +++ b/Datasheet.cs @@ -194,6 +194,20 @@ namespace Gidrolock_Modbus_Scanner } } + if (device.wiredLineBreak != null || device.wiredLineBreak.Count > 0) + { + for (int i = 0; i < device.wiredLineBreak.Count; i++) + { + res = await PollEntry(device.wiredLineBreak[i]); + if (res) + { + bool value = latestMessage.Data[0] > 0x00 ? true : false; + WiredSensor snsr = sensorPanel.Controls[i] as WiredSensor; + snsr.labelBreak.Text = value ? "Обрыв!" : "ОК"; + } + } + } + res = await PollEntry(device.sensorAlarm); if (res) { diff --git a/Gidrolock Modbus Configurator.csproj b/Gidrolock Modbus Configurator.csproj index 4c56a59..4e122e8 100644 --- a/Gidrolock Modbus Configurator.csproj +++ b/Gidrolock Modbus Configurator.csproj @@ -6,7 +6,7 @@ AnyCPU {47A399D3-30C1-4EF4-9E94-F3518919A59C} WinExe - Gidrolock_Modbus_Scanner + Gidrolock_Modbus_Configurator Gidrolock Modbus Configurator v4.8 512 diff --git a/Main.cs b/Main.cs index ede60e5..f268924 100644 --- a/Main.cs +++ b/Main.cs @@ -316,7 +316,11 @@ namespace Gidrolock_Modbus_Scanner d.wiredSensors = 2; d.hasScenarioSensor = true; d.sensorAlarm = new Entry(RegisterType.Discrete, 1343, 24); - + d.wiredLineBreak = new List() + { + new Entry(RegisterType.Discrete, 1205), + new Entry(RegisterType.Discrete, 1207) + }; d.radioStatus = new Entry(RegisterType.Input, 1215, 21); break; @@ -338,7 +342,11 @@ namespace Gidrolock_Modbus_Scanner d.wiredSensors = 2; d.hasScenarioSensor = false; d.sensorAlarm = new Entry(RegisterType.Discrete, 1343, 23); - + d.wiredLineBreak = new List() + { + new Entry(RegisterType.Discrete, 1205), + new Entry(RegisterType.Discrete, 1207) + }; d.radioStatus = new Entry(RegisterType.Input, 1215, 21); break; @@ -367,6 +375,16 @@ namespace Gidrolock_Modbus_Scanner d.wiredSensors = 7; d.hasScenarioSensor = true; d.sensorAlarm = new Entry(RegisterType.Discrete, 1343, 29); + d.wiredLineBreak = new List() + { + new Entry(RegisterType.Discrete, 1025), + new Entry(RegisterType.Discrete, 1026), + new Entry(RegisterType.Discrete, 1027), + new Entry(RegisterType.Discrete, 1028), + new Entry(RegisterType.Discrete, 1029), + new Entry(RegisterType.Discrete, 1030), + new Entry(RegisterType.Discrete, 1031), + }; d.radioStatus = new Entry(RegisterType.Input, 1215, 21); break; case DeviceType.Premium: diff --git a/Modbus.cs b/Modbus.cs index ec3b7f7..b83763c 100644 --- a/Modbus.cs +++ b/Modbus.cs @@ -283,7 +283,7 @@ namespace Gidrolock_Modbus_Scanner try { stopwatch.Restart(); - while (stopwatch.ElapsedMilliseconds < 20) + while (stopwatch.ElapsedMilliseconds < 50) { if (port.BytesToRead > 0) { diff --git a/Model.cs b/Model.cs index 8a1c3bb..8e89d13 100644 --- a/Model.cs +++ b/Model.cs @@ -26,7 +26,7 @@ namespace Gidrolock_Modbus_Scanner public Entry sensorAlarm; public List wiredLineBreak; - + public Entry radioStatus; } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 45592ee..82917e8 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.9.4.0")] -[assembly: AssemblyFileVersion("0.9.4.0")] +[assembly: AssemblyVersion("0.9.5.0")] +[assembly: AssemblyFileVersion("0.9.5.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 2198345..b9a4de3 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Gidrolock_Modbus_Scanner.Properties { +namespace Gidrolock_Modbus_Configurator.Properties { using System; @@ -39,7 +39,7 @@ namespace Gidrolock_Modbus_Scanner.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gidrolock_Modbus_Scanner.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gidrolock_Modbus_Configurator.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index df0c1cb..6b9c2f5 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Gidrolock_Modbus_Scanner.Properties { +namespace Gidrolock_Modbus_Configurator.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]