From 66650d535fac328335568760795228af5b396dfd Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 17 Mar 2017 09:24:59 +0100 Subject: [PATCH] pulizia codice: eliminato commenti inutili tipo #if false residui --- MTC_Adapter/MTC_Adapter/AdapterDemo.cs | 5 -- MTC_Adapter/MTC_Adapter/AdapterSiemens.cs | 9 +-- MTC_Adapter/MTC_Adapter/EnumExtensions.cs | 20 ------ MTC_Adapter/MTC_Adapter/MainForm.cs | 19 ----- .../Resources/SCM/EsaKvara_SIM.ini | 3 + MTC_Adapter/MTC_Adapter/utils.cs | 11 --- MTC_Adapter/SCMCncLib/thdNcEsaGvKvara.cs | 69 ++----------------- 7 files changed, 10 insertions(+), 126 deletions(-) diff --git a/MTC_Adapter/MTC_Adapter/AdapterDemo.cs b/MTC_Adapter/MTC_Adapter/AdapterDemo.cs index 0d90a93..bca0939 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterDemo.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterDemo.cs @@ -125,11 +125,6 @@ namespace MTC_Adapter vettPath[PtData.PathSel].mPathType.Value = PtData.PathType; vettPath[PtData.PathSel].mPathPartId.Value = PtData.PartId; vettPath[PtData.PathSel].mPathPartCount.Value = PtData.pzTot; -#if false - vettPath[PtData.PathSel].mPathCodM.Value = PtData.co; - vettPath[PtData.PathSel].mPathCodS.Value = PtData.PathType; - vettPath[PtData.PathSel].mPathCodT.Value = PtData.PathType; -#endif vettPath[PtData.PathSel].mPathRunMode.Value = PtData.RunMode; vettPath[PtData.PathSel].mPathExeMode.Value = PtData.ExeMode; vettPath[PtData.PathSel].mPathCurrProg.Value = PtData.ProgramName; diff --git a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs index 1a0d9e3..018f206 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs @@ -1294,14 +1294,7 @@ namespace MTC_Adapter inizio = DateTime.Now; FanucMemRW(R, FANUC.MemType.D, memIndex, ref unOpSpeedMem); if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-SPEED_UNOP", unOpSpeedMem.Length), DateTime.Now.Subtract(inizio).Ticks); - - // NON VA: RICHIEDE OPZIONE... The extended driver/library function is necessary. -#if false - // recupero vettore load spindle... - inizio = DateTime.Now; - CMSCncLib.Focas1.ODBSPN spindleVect = FANUC_ref.getSpindleLoad(); - if (utils.CRB("recTime")) TimingData.addResult("R-SpindleLoad", DateTime.Now.Subtract(inizio).Ticks); -#endif + StringBuilder sb = new StringBuilder(); int numUnOp = currAdpConf.nUnOp; diff --git a/MTC_Adapter/MTC_Adapter/EnumExtensions.cs b/MTC_Adapter/MTC_Adapter/EnumExtensions.cs index 58a4b05..ff06c74 100644 --- a/MTC_Adapter/MTC_Adapter/EnumExtensions.cs +++ b/MTC_Adapter/MTC_Adapter/EnumExtensions.cs @@ -28,26 +28,6 @@ namespace MTC_Adapter return false; } } -#if false - /// - /// Get bit from byte - /// - /// - /// - /// - /// - public static bool getBit(this System.Enum type, int bitNum) - { - try - { - return (((Byte)(object)type & (1 << bitNum - 1)) != 0); - } - catch - { - return false; - } - } -#endif /// /// checks if the value is only the provided type diff --git a/MTC_Adapter/MTC_Adapter/MainForm.cs b/MTC_Adapter/MTC_Adapter/MainForm.cs index 3710d9a..efd94e0 100644 --- a/MTC_Adapter/MTC_Adapter/MainForm.cs +++ b/MTC_Adapter/MTC_Adapter/MainForm.cs @@ -544,11 +544,6 @@ namespace MTC_Adapter advProgBar(); if (agObj.connectionOk) { -#if false - // eseguo eventuali simulazioni x dati/flags SE RICHIESTO - simulateData(); -#endif - // check esecuzione FastTask checkFastTask(); @@ -704,12 +699,6 @@ namespace MTC_Adapter private void message_Leave(object sender, EventArgs e) { -#if false - agObj.mMessage.Code = messageCode.Text; - agObj.mMessage.Value = messageText.Text; - agObj.mMessage.ForceChanged(); - agObj.mAdapter.SendChanged(); -#endif } // apro eseguibile dump @@ -1540,10 +1529,6 @@ namespace MTC_Adapter private void xPosition_Scroll(object sender, ScrollEventArgs e) { -#if false - agObj.mPosition.Value = xPosition.Value; - agObj.mAdapter.SendChanged(); -#endif AxPositionValue.Text = AxPosition.Value.ToString(); } @@ -1555,10 +1540,6 @@ namespace MTC_Adapter private void cSpeed_Scroll(object sender, ScrollEventArgs e) { -#if false - agObj.mSpeed.Value = cSpeed.Value; - agObj.mAdapter.SendChanged(); -#endif AxFeedOverValue.Text = AxFeedOver.Value.ToString(); } diff --git a/MTC_Adapter/MTC_Adapter/Resources/SCM/EsaKvara_SIM.ini b/MTC_Adapter/MTC_Adapter/Resources/SCM/EsaKvara_SIM.ini index a5939aa..15f91a7 100644 --- a/MTC_Adapter/MTC_Adapter/Resources/SCM/EsaKvara_SIM.ini +++ b/MTC_Adapter/MTC_Adapter/Resources/SCM/EsaKvara_SIM.ini @@ -89,6 +89,9 @@ IOT_AreaAddressByte=IOT.BYTE IOT_AreaAddressWord=IOT.WORD IOT_AreaAddressDWord=IOT.DWORD IOT_AreaAddressStringA=IOT.ProgramNameAreaA +IOT_AreaAddressStringB=IOT.ProgramNameAreaB +IOT_AreaAddressStringC=IOT.ProgramNameAreaC +IOT_AreaAddressStringD=IOT.ProgramNameAreaD [XILOG] Enable=1 diff --git a/MTC_Adapter/MTC_Adapter/utils.cs b/MTC_Adapter/MTC_Adapter/utils.cs index 2059491..ced815e 100644 --- a/MTC_Adapter/MTC_Adapter/utils.cs +++ b/MTC_Adapter/MTC_Adapter/utils.cs @@ -161,17 +161,6 @@ namespace MTC_Adapter byte mask = (byte)(bitVal << bitInByteIndex); // imposto! answ[byteIndex] |= mask; -#if false - byte mask = (byte)(1 << bitInByteIndex); - bool isSet = (bytes[byteIndex] & mask) != 0; - // set to 1 - bytes[byteIndex] |= mask; - // Set to zero - bytes[byteIndex] &= ~mask; - // Toggle - bytes[byteIndex] ^= mask; -#endif - } } return answ; diff --git a/MTC_Adapter/SCMCncLib/thdNcEsaGvKvara.cs b/MTC_Adapter/SCMCncLib/thdNcEsaGvKvara.cs index ffc361b..4109dff 100644 --- a/MTC_Adapter/SCMCncLib/thdNcEsaGvKvara.cs +++ b/MTC_Adapter/SCMCncLib/thdNcEsaGvKvara.cs @@ -42,12 +42,6 @@ namespace SCMCncLib private UInt16 IOT_WordAreaByteSize; private UInt16 IOT_DWordAreaByteSize; private UInt16 IOT_String_AreaByteSize; -#if false - private UInt16 IOT_StringA_AreaByteSize; - private UInt16 IOT_StringB_AreaByteSize; - private UInt16 IOT_StringC_AreaByteSize; - private UInt16 IOT_StringD_AreaByteSize; -#endif private string SysLink = ""; @@ -158,40 +152,6 @@ namespace SCMCncLib /// memorie a 1 byte (8 bit) x area IOT.String (singoli caratteri...) /// public Byte[,] PLC_MemoryAreaIOT_String; -#if false - /// - /// memorie TEMP x area IOT.StringA - /// - public UInt32[] PLC_MemoryAreaIOT_StringA_tmp; - /// - /// memorie a 1 byte (8 bit) x area IOT.StringA (singoli caratteri...) - /// - public Byte[] PLC_MemoryAreaIOT_StringA; - /// - /// memorie TEMP x area IOT.StringB - /// - public UInt32[] PLC_MemoryAreaIOT_StringB_tmp; - /// - /// memorie a 1 byte (8 bit) x area IOT.StringB (singoli caratteri...) - /// - public Byte[] PLC_MemoryAreaIOT_StringB; - /// - /// memorie TEMP x area IOT.StringC - /// - public UInt32[] PLC_MemoryAreaIOT_StringC_tmp; - /// - /// memorie a 1 byte (8 bit) x area IOT.StringC (singoli caratteri...) - /// - public Byte[] PLC_MemoryAreaIOT_StringC; - /// - /// memorie TEMP x area IOT.StringD - /// - public UInt32[] PLC_MemoryAreaIOT_StringD_tmp; - /// - /// memorie a 1 byte (8 bit) x area IOT.StringD (singoli caratteri...) - /// - public Byte[] PLC_MemoryAreaIOT_StringD; -#endif #endregion @@ -284,13 +244,6 @@ namespace SCMCncLib IOT_WordAreaByteSize = Convert.ToUInt16(IAS_Word); IOT_DWordAreaByteSize = Convert.ToUInt16(IAS_DWord); IOT_String_AreaByteSize = Convert.ToUInt16(IAS_String); -#if false - IOT_StringA_AreaByteSize = Convert.ToUInt16(IAS_String); - IOT_StringB_AreaByteSize = Convert.ToUInt16(IAS_String); - IOT_StringC_AreaByteSize = Convert.ToUInt16(IAS_String); - IOT_StringD_AreaByteSize = Convert.ToUInt16(IAS_String); -#endif - CommandsAddressName = fIni.ReadString("NC", "CommandsAddress", "SIMREAD[0]"); EOKAreaAddressName = fIni.ReadString("NC", "EOKAreaAddress", "EOK"); @@ -303,10 +256,10 @@ namespace SCMCncLib IOT_ByteAreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressByte", "IOT.BYTE"); IOT_WordAreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressWord", "IOT.WORD"); IOT_DWordAreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressDWord", "IOT.DWORD"); - IOT_StringA_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressString", "IOT.ProgramNameAreaA"); - IOT_StringB_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressString", "IOT.ProgramNameAreaB"); - IOT_StringC_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressString", "IOT.ProgramNameAreaC"); - IOT_StringD_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressString", "IOT.ProgramNameAreaD"); + IOT_StringA_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressStringA", "IOT.ProgramNameAreaA"); + IOT_StringB_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressStringB", "IOT.ProgramNameAreaB"); + IOT_StringC_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressStringC", "IOT.ProgramNameAreaC"); + IOT_StringD_AreaAddressName = fIni.ReadString("NC", "IOT_AreaAddressStringD", "IOT.ProgramNameAreaD"); /************************************************** * Creazione buffers letture memoria @@ -337,18 +290,8 @@ namespace SCMCncLib PLC_MemoryAreaIOT_Word = new UInt16[IOT_WordAreaByteSize]; PLC_MemoryAreaIOT_DWord = new UInt32[IOT_DWordAreaByteSize]; PLC_MemoryAreaIOT_String_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_String_AreaByteSize / 4)]; - PLC_MemoryAreaIOT_String_row = new Byte[IOT_String_AreaByteSize * 4]; // HARD CODED 4 aree in riga... - PLC_MemoryAreaIOT_String = new Byte[4, IOT_String_AreaByteSize]; // HARD CODED 4 aree... -#if false - PLC_MemoryAreaIOT_StringA_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_StringA_AreaByteSize / 4)]; - PLC_MemoryAreaIOT_StringA = new Byte[IOT_StringA_AreaByteSize]; - PLC_MemoryAreaIOT_StringB_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_StringB_AreaByteSize / 4)]; - PLC_MemoryAreaIOT_StringB = new Byte[IOT_StringB_AreaByteSize]; - PLC_MemoryAreaIOT_StringC_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_StringC_AreaByteSize / 4)]; - PLC_MemoryAreaIOT_StringC = new Byte[IOT_StringC_AreaByteSize]; - PLC_MemoryAreaIOT_StringD_tmp = new UInt32[(int)Math.Ceiling((decimal)IOT_StringD_AreaByteSize / 4)]; - PLC_MemoryAreaIOT_StringD = new Byte[IOT_StringD_AreaByteSize]; -#endif + PLC_MemoryAreaIOT_String_row = new Byte[IOT_String_AreaByteSize * 4]; // HARD CODED 4 aree consecutive in riga... + PLC_MemoryAreaIOT_String = new Byte[4, IOT_String_AreaByteSize]; // HARD CODED 4 aree su vettore di 4 righe... if (!Connect()) Disconnect();