From f3f1e38703409486f11a7eb697b8a30361d56aa2 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 19 May 2017 17:09:13 +0200 Subject: [PATCH] fix controllo strobe secondo processo (OSAI e SIEMENS) + allineamento fanuc... --- MTC_Adapter/MTC_Adapter/AdapterFanuc.cs | 12 ++++++------ MTC_Adapter/MTC_Adapter/AdapterGeneric.cs | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs index 7d4ca93..c40774c 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs @@ -217,7 +217,7 @@ namespace MTC_Adapter string UnkStrobe = ""; // !!!FARE!!! multipath... // verifico i vari strobe x recuperare i dati... PER ORA SOLO DW1 per path1 (indice 0)... - //int idxPath = 0; + int idxPath = 0; int memIndex = 0; int bitNum = 0; inizio = DateTime.Now; @@ -272,18 +272,18 @@ namespace MTC_Adapter // AREA strobe USER ACTION // chiamato Start... bitNum = 4; - gestStrobeUserAction(bitNum, ref retACK_DW1, ref UserAction, " (START) "); + gestStrobeUserAction(idxPath, bitNum, ref retACK_DW1, ref UserAction, " (START) "); // chiamato Stop... bitNum = 5; - gestStrobeUserAction(bitNum, ref retACK_DW1, ref UserAction, " (STOP) "); + gestStrobeUserAction(idxPath, bitNum, ref retACK_DW1, ref UserAction, " (STOP) "); // chiamato Reset... bitNum = 6; - gestStrobeUserAction(bitNum, ref retACK_DW1, ref UserAction, " (RESET) "); + gestStrobeUserAction(idxPath, bitNum, ref retACK_DW1, ref UserAction, " (RESET) "); // processo tutti gli strobe x i BIT 7-29 NON gestiti in modo da dare comunque ACK e event... for (int i = 7; i < 30; i++) { - gestStrobeUserAction(i, ref retACK_DW1, ref UnkStrobe, string.Format(" [STROBE_{0:00}] ", i)); + gestStrobeUserAction(idxPath, i, ref retACK_DW1, ref UnkStrobe, string.Format(" [STROBE_{0:00}] ", i)); } // AREA strobe x TEST @@ -361,7 +361,7 @@ namespace MTC_Adapter int memIndex = 10508; return FanucMemRW(W, FANUC.MemType.R, memIndex, ref retACK_DW); } - + /// /// Recupero info su test: numero + elenco parametri IN/OUT /// diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs index d367a10..675f7bf 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs @@ -2389,13 +2389,14 @@ namespace MTC_Adapter /// /// Gestione strobe UserAction: salva dati e gestione ACK /// + /// /// /// /// /// - public void gestStrobeUserAction(int bitNum, ref byte[] retACK_DW1, ref string UserAction, string azione) + public void gestStrobeUserAction(int idxPath, int bitNum, ref byte[] retACK_DW1, ref string UserAction, string azione) { - if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum))) + if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum + 16 * idxPath))) { // salvo evento UserAction in variabile... UserAction += azione; @@ -2838,13 +2839,13 @@ namespace MTC_Adapter // AREA strobe USER ACTION // chiamato Start... bitNum = 4; - gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} START) ", idxPath + 1)); + gestStrobeUserAction(idxPath, bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} START) ", idxPath + 1)); // chiamato Stop... bitNum = 5; - gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} STOP) ", idxPath + 1)); + gestStrobeUserAction(idxPath, bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} STOP) ", idxPath + 1)); // chiamato Reset... bitNum = 6; - gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} RESET) ", idxPath + 1)); + gestStrobeUserAction(idxPath, bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} RESET) ", idxPath + 1)); } else