diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index 240ff47..f1dd15f 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -159,7 +159,18 @@ namespace MTC_Adapter parentForm.commPlcActive = false; return answ; } - + /// + /// variabile contatore cicli prima di rileggere codici G di un path inattivo... + /// + public int contChkGCod; + /// + /// Vettore codici G attivi x PATH 1... + /// + ushort[] vettGCodes_01; + /// + /// Vettore codici G attivi x PATH 2... + /// + ushort[] vettGCodes_02; /// /// struttura dati OSAI x dati NC (pag 148) /// @@ -183,6 +194,12 @@ namespace MTC_Adapter MemBlock_MST = new byte[52]; // salto necessario! saltoMST = 1; + + // GCodes! + vettGCodes_01 = new ushort[14]; + vettGCodes_02 = new ushort[14]; + contChkGCod = utils.CRI("contChkGCod"); + // è littel endian (NON serve conversione) hasBigEndian = false; @@ -879,40 +896,40 @@ namespace MTC_Adapter public override void getPath() { - - - - // NON ci sono nella documentazione metodi x recuperare posizione PuntaUtensile, in attesa news da OSAI/Andrea... -#if false - - parentForm.commPlcActive = true; - inizio = DateTime.Now; - CMSCncLib.Focas1.ODB5AXMAN vettTTCoord = OSAI_ref.getPathTTCoord(); - if (utils.CRB("recTime")) TimingData.addResult("R-TTCoord", DateTime.Now.Subtract(inizio).Ticks); - parentForm.commPlcActive = false; -#endif // ciclo su path StringBuilder sb_2; StringBuilder sb_3; + ushort[] vettGCodes; + + // faccio VERA lettura SOLO ogni TOT cicli... + if (contChkGCod <= 0) + { + // reimposto contatore + contChkGCod = utils.CRI("contChkGCod"); + // recupero vettore generale G MODE + parentForm.commPlcActive = true; + inizio = DateTime.Now; + OSAI_ref.getPathGCodeMod(1, ref vettGCodes_01); + OSAI_ref.getPathGCodeMod(2, ref vettGCodes_01); + if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; + } + else + { + contChkGCod--; + } + for (int i = 0; i < currAdpConf.nPath; i++) { // accodo dati path in DataMonitor... sb_2 = new StringBuilder(); sb_3 = new StringBuilder(); - // recupero vettore generale G MODE - parentForm.commPlcActive = true; - inizio = DateTime.Now; - ushort[] vettGCodes = new ushort[14]; - OSAI_ref.getPathGCodeMod(i + 1, ref vettGCodes); - if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks); - parentForm.commPlcActive = false; - // attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535 string GCodAttivi = ""; - + vettGCodes = i == 0 ? vettGCodes_01 : vettGCodes_02; for (int j = 0; j < vettGCodes.Length; j++) { // se il valore è < di UShort.max (65535)... diff --git a/MTC_Adapter/MTC_Adapter/App.config b/MTC_Adapter/MTC_Adapter/App.config index 999c247..7fcadb7 100644 --- a/MTC_Adapter/MTC_Adapter/App.config +++ b/MTC_Adapter/MTC_Adapter/App.config @@ -17,6 +17,8 @@ + +