From 08ae599540d5a44bcd9416a8a5efa7eb85b766b1 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 22 Nov 2018 21:06:06 +0100 Subject: [PATCH] fix gestione override che dava errori (ora sono OK) --- IOB-WIN/IobGeneric.cs | 3 +-- IOB-WIN/IobOSAI.cs | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index a6e927f6..7f843a02 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -1937,8 +1937,7 @@ namespace IOB_WIN { Dictionary currOverride = new Dictionary(); if (!DemoIn) - { - + { if (connectionOk) { currOverride = getOverrides(); diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs index 50279a5c..c0c19347 100644 --- a/IOB-WIN/IobOSAI.cs +++ b/IOB-WIN/IobOSAI.cs @@ -48,6 +48,10 @@ namespace IOB_WIN /// LookUpTable di decodifica da CNC a segnali tipo bitmap MAPO /// Dictionary signLUT = new Dictionary(); + /// + /// Struttura dati principale in continuo update... + /// + protected Cndex.GETINFO1DATA oData; /// /// wrapper chiamata lettura/scrittura OSAI x BYTE... @@ -241,9 +245,9 @@ namespace IOB_WIN // inizializzo correttamente aree memoria secondo CONF - iniFileName IniFile fIni = new IniFile(IOBConf.iniFileName); - + // inizializzo aree di memoria correnti... - + // fix enable prgName enablePrgName = fIni.ReadBoolean("CNC", "GETPRGNAME", true); @@ -281,7 +285,7 @@ namespace IOB_WIN if (utils.CRB("verbose")) { - lgInfo(string.Format("INIT OSAI_ref da CncLib come {0}",IOBConf.tipoIob)); + lgInfo(string.Format("INIT OSAI_ref da CncLib come {0}", IOBConf.tipoIob)); } // disconnetto e connetto... @@ -301,7 +305,7 @@ namespace IOB_WIN lgInfo(string.Format("Lettura preliminare: machineStatus={0} | modeSelected={1}", machineStatus, modeSelected)); // possiamo leggere tutto da qui che contiene status, mode e last_nc_error - Cndex.GETINFO1DATA oData = new Cndex.GETINFO1DATA(); + oData = new Cndex.GETINFO1DATA(); var ncInfo = OSAI_ref.NcInfo1(ref oData); // esempio dati var lastNcError = oData.last_nc_error; @@ -312,7 +316,7 @@ namespace IOB_WIN var speedPrg = oData.progr_speed; var speedReal = oData.real_speed; var modeSel = oData.real_feed; - + lgInfo(string.Format("Lettura START completa NCINFO1DATA{0} lastNcError={1}{0}status={2}{0}substatus={9}{0}mode_select={3}{0}main_progr_name={4}{0}speed_ov={5}{0}progr_speed={6}{0}real_speed={7}{0}real_feed={8}{0}", Environment.NewLine, oData.last_nc_error, oData.status, oData.mode_select, oData.main_progr_name, oData.speed_ov, oData.progr_speed, oData.real_speed, oData.real_feed, oData.substatus)); @@ -484,7 +488,7 @@ namespace IOB_WIN try { // ora provo connessione... - parentForm.commPlcActive = true; + parentForm.commPlcActive = true; OSAI_ref.OpenSession(); parentForm.commPlcActive = false; @@ -536,7 +540,7 @@ namespace IOB_WIN processMemoryDiscon(); } } - + /// /// lettura principale (bit semafori) /// @@ -553,9 +557,9 @@ namespace IOB_WIN parentForm.sIN = Semaforo.SV; // possiamo leggere tutto da qui che contiene status, mode e last_nc_error - Cndex.GETINFO1DATA oData = new Cndex.GETINFO1DATA(); + //oData = new Cndex.GETINFO1DATA(); var ncInfo = OSAI_ref.NcInfo1(ref oData); - + lgInfo(string.Format("Lettura completa NCINFO1DATA{0} lastNcError={1}{0}status={2}{0}substatus={9}{0}mode_select={3}{0}main_progr_name={4}{0}speed_ov={5}{0}progr_speed={6}{0}real_speed={7}{0}real_feed={8}{0}", Environment.NewLine, oData.last_nc_error, oData.status, oData.mode_select, oData.main_progr_name, oData.speed_ov, oData.progr_speed, oData.real_speed, oData.real_feed, oData.substatus)); @@ -1124,13 +1128,8 @@ namespace IOB_WIN public override Dictionary getOverrides() { Dictionary outVal = new Dictionary(); -#if false - if (utils.CRB("enableMode") && MemBlockG != null) - { - outVal.Add("FEED_OVER", MemBlockG[30].ToString()); - outVal.Add("RAPID_OVER", MemBlockG[12].ToString()); - } -#endif + outVal.Add("FEED_OVER", (oData.feed_ov).ToString()); + outVal.Add("RAPID_OVER", (oData.rapid_override).ToString()); return outVal; }