From f9f0a99672546749f3d9168d22162ba3a69e1fff Mon Sep 17 00:00:00 2001 From: Federico Barresi Date: Fri, 5 Aug 2022 22:21:59 +0200 Subject: [PATCH 1/2] Fixed variable length for double types - added default value for variables of type double (float in PLCs) this error avoid getting notification from type float or double. --- Sharp7.Rx/S7VariableNameParser.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sharp7.Rx/S7VariableNameParser.cs b/Sharp7.Rx/S7VariableNameParser.cs index b5213b3..a53e8ef 100644 --- a/Sharp7.Rx/S7VariableNameParser.cs +++ b/Sharp7.Rx/S7VariableNameParser.cs @@ -74,6 +74,10 @@ namespace Sharp7.Rx { s7VariableAddress.Length = 8; } + else if (type == DbType.Double) + { + s7VariableAddress.Length = 4; + } return s7VariableAddress; } From 21f9b3286367367583838ae2528dedd6746d02f6 Mon Sep 17 00:00:00 2001 From: Federico Barresi Date: Fri, 5 Aug 2022 22:26:58 +0200 Subject: [PATCH 2/2] fixed tests --- Sharp7.Rx.Tests/ParsingS7VariableName.feature | 2 +- Sharp7.Rx.Tests/ParsingS7VariableName.feature.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sharp7.Rx.Tests/ParsingS7VariableName.feature b/Sharp7.Rx.Tests/ParsingS7VariableName.feature index e836e9d..82d3be1 100644 --- a/Sharp7.Rx.Tests/ParsingS7VariableName.feature +++ b/Sharp7.Rx.Tests/ParsingS7VariableName.feature @@ -31,7 +31,7 @@ Scenario: Parsing variable name for bool | Db | 5 | 887 | 20 | 0 | String | | Db | 506 | 216 | 1 | 0 | Byte | | Db | 506 | 216 | 5 | 0 | Byte | - | Db | 506 | 216 | 0 | 0 | Double | + | Db | 506 | 216 | 4 | 0 | Double | | Db | 506 | 216 | 4 | 0 | DInteger | | Db | 506 | 216 | 2 | 0 | Integer | | Db | 506 | 216 | 2 | 0 | Integer | diff --git a/Sharp7.Rx.Tests/ParsingS7VariableName.feature.cs b/Sharp7.Rx.Tests/ParsingS7VariableName.feature.cs index 396af89..18959ea 100644 --- a/Sharp7.Rx.Tests/ParsingS7VariableName.feature.cs +++ b/Sharp7.Rx.Tests/ParsingS7VariableName.feature.cs @@ -186,7 +186,7 @@ this.ScenarioInitialize(scenarioInfo); "Db", "506", "216", - "0", + "4", "0", "Double"}); table2.AddRow(new string[] {