From 5b9dbbd6374cf08ddd49f5602bdbdace7a2c376c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlegger?= Date: Wed, 6 Aug 2025 09:53:39 +0200 Subject: [PATCH] Fix: Handle Min/Max values for REAL (Step7) accordingly --- LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs index 000e10c0..c52050db 100644 --- a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs +++ b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs @@ -107,7 +107,10 @@ public static object StringValueToObject(string Value, S7DataRowType DataType) else if (DataType == S7DataRowType.DINT) return Int32.Parse(Value.Replace("L#", "")); else if (DataType == S7DataRowType.REAL) - return float.Parse(Value.Replace('.',',')); + // Handle Max/Min REAL values accordingly (e.g., "-3.402823e+038" or "3.402823e+038") + return float.TryParse(Value.Replace(".", ","), out float result) + ? result + : Value.StartsWith("-") ? float.MinValue : float.MaxValue; else if (DataType == S7DataRowType.S5TIME) return Helper.GetTimespanFromS5TimeorTime(Value); else if (DataType == S7DataRowType.TIME)