From 19a2b331aa1b6aa8bd4457c54abda41a76202394 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 17 Jul 2020 14:53:20 +0200 Subject: [PATCH] FIX S7Net block messages translation + terminated block --- CMS_CORE_Library/Models/ThermoModels.cs | 3 +++ CMS_CORE_Library/S7Net/Nc_S7Net.cs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMS_CORE_Library/Models/ThermoModels.cs b/CMS_CORE_Library/Models/ThermoModels.cs index 2b59b9d..4523337 100644 --- a/CMS_CORE_Library/Models/ThermoModels.cs +++ b/CMS_CORE_Library/Models/ThermoModels.cs @@ -111,6 +111,7 @@ namespace CMS_CORE_Library.Models public bool Visible { get; set; } = false; public bool Running { get; set; } = false; public bool HasError { get; set; } = false; + public bool Terminated { get; set; } = false; public override bool Equals(object obj) { @@ -136,6 +137,8 @@ namespace CMS_CORE_Library.Models return false; if (HasError != item.HasError) return false; + if (Terminated != item.Terminated) + return false; return true; } diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs index 8cd615b..8d769d4 100644 --- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs +++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs @@ -265,7 +265,7 @@ namespace CMS_CORE_Library.S7Net .ToDictionary(line => line[0].Trim(), line => line[1].Trim()); // Setup the Path for labels - filePath = THERMO_DICT_PATH + @"labels_" + langName + @".txt"; + filePath = THERMO_DICT_PATH + @"Labels_" + langName + @".txt"; // Read From File... dict02 = File.ReadAllLines(filePath, Encoding.Default) @@ -2569,6 +2569,7 @@ namespace CMS_CORE_Library.S7Net ThermoModuleList[currModBlock.Id].Visible = currModBlock.Visible; ThermoModuleList[currModBlock.Id].Running = currModBlock.Running; ThermoModuleList[currModBlock.Id].HasError = currModBlock.HasError; + ThermoModuleList[currModBlock.Id].Terminated = currModBlock.Terminated; ThermoModuleList[currModBlock.Id].ActualDuration = currModBlock.ActualDuration; ThermoModuleList[currModBlock.Id].ActualDelay = currModBlock.ActualDelay; } @@ -2586,7 +2587,8 @@ namespace CMS_CORE_Library.S7Net ActualDelay = currModBlock.ActualDelay, Visible = currModBlock.Visible, Running = currModBlock.Running, - HasError = currModBlock.HasError + HasError = currModBlock.HasError, + Terminated = currModBlock.Terminated }); } catch @@ -2673,6 +2675,7 @@ namespace CMS_CORE_Library.S7Net public bool Visible { get; set; } public bool Running { get; set; } public bool HasError { get; set; } + public bool Terminated { get; set; } = false; /// /// Deserializzazione da byte ad oggetto ParamRT /// @@ -2689,6 +2692,7 @@ namespace CMS_CORE_Library.S7Net Visible = (Stato & 1) == 1; Running = (Stato & 2) == 2; HasError = (Stato & 4) == 4; + Terminated = (Stato & 8) == 8; } /// /// Converte un singolo item in un array di byte per scrittura su PLC S7 @@ -2701,6 +2705,7 @@ namespace CMS_CORE_Library.S7Net Stato += (ushort)(Visible ? 1 : 0); Stato += (ushort)(Running ? 2 : 0); Stato += (ushort)(HasError ? 4 : 0); + Stato += (ushort)(Terminated ? 8 : 0); byte[] answ = new byte[12]; Buffer.BlockCopy(S7.Net.Types.Int.ToByteArray(Id), 0, answ, 0, 2); Buffer.BlockCopy(S7.Net.Types.DInt.ToByteArray(ActualDuration), 0, answ, 2, 4);