diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index 8d4c74ec..e78420fd 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -202,30 +202,37 @@ namespace IOB_WIN public override void readSemafori() { base.readSemafori(); - - if (verboseLog) lg.Info("inizio read semafori"); - parentForm.sIN = Semaforo.SV; - // leggo SEMAFORI, leggo da Y8 ...leggo 3 bit in Y8..Y10 HARD CODED, rendere parametrico!!! - byte[] MemBlock = new byte[4]; - // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5 - int memIndex = 8; - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); - // riporto! - Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); - // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... - MemBlock = new byte[2]; - // GESTIONE memoria endcycle - // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI --> copio 2 byte! - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); - // riporto! - Buffer.BlockCopy(MemBlock, 0, RawInput, 4, 2); - if (verboseLog) lg.Info(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); - // salvo il solo BYTE dell'input decifrando il semaforo... - decodeToBitmap(); + try + { + if (verboseLog) lg.Info("inizio read semafori"); + parentForm.sIN = Semaforo.SV; + // leggo SEMAFORI, leggo da Y8 ...leggo 3 bit in Y8..Y10 HARD CODED, rendere parametrico!!! + byte[] MemBlock = new byte[4]; + // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5 + int memIndex = 8; + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); + // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... + MemBlock = new byte[2]; + // GESTIONE memoria endcycle + // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI --> copio 2 byte! + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 4, 2); + if (verboseLog) lg.Info(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); + // salvo il solo BYTE dell'input decifrando il semaforo... + decodeToBitmap(); + } + catch (Exception exc) + { + lg.Error(string.Format("Eccezione in readSemafori:{0}{1}", Environment.NewLine, exc)); + connectionOk = false; + } } /// /// Effettua decodifica aree memoria alla bitmap usata x MAPO @@ -299,6 +306,7 @@ namespace IOB_WIN catch (Exception exc) { lg.Error(string.Format("Eccezione in recupero PRG NAME MAIN:{0}{1}", Environment.NewLine, exc)); + connectionOk = false; } return prgName; } @@ -335,6 +343,7 @@ namespace IOB_WIN catch (Exception exc) { lg.Error(exc, "Errore in getSysInfo"); + connectionOk = false; } return outVal; } @@ -395,6 +404,7 @@ namespace IOB_WIN catch (Exception exc) { lg.Error(exc, "Errore in contapezzi FANUC"); + connectionOk = false; } } } @@ -429,6 +439,7 @@ namespace IOB_WIN catch (Exception exc) { lg.Error(exc, "Errore in process Mode G43"); + connectionOk = false; } } } diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index f46eecbe..4de6124e 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -1410,7 +1410,14 @@ namespace IOB_WIN string currPrgName = ""; if (!DemoIn) { - currPrgName = getPrgName(); + if (connectionOk) + { + currPrgName = getPrgName(); + } + else + { + lg.Error("Errore connessione mancante x getPrgName"); + } } else { @@ -1437,7 +1444,14 @@ namespace IOB_WIN Dictionary currSysInfo = new Dictionary(); if (!DemoIn) { - currSysInfo = getSysInfo(); + if (connectionOk) + { + currSysInfo = getSysInfo(); + } + else + { + lg.Error("Errore connessione mancante x getSysInfo"); + } } else { @@ -1520,7 +1534,14 @@ namespace IOB_WIN Dictionary currDynData = new Dictionary(); if (!DemoIn) { - currDynData = getDynData(); + if (connectionOk) + { + currDynData = getDynData(); + } + else + { + lg.Error("Errore connessione mancante x getDynData"); + } } else { @@ -1553,7 +1574,15 @@ namespace IOB_WIN Dictionary currOverride = new Dictionary(); if (!DemoIn) { - currOverride = getOverrides(); + + if (connectionOk) + { + currOverride = getOverrides(); + } + else + { + lg.Error("Errore connessione mancante x getOverrides"); + } } else { diff --git a/Jenkinsfile b/Jenkinsfile index f55fa44a..d5acca84 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=207']) { + withEnv(['NEXT_BUILD_NUMBER=208']) { // env.versionNumber = VersionNumber(versionNumberString : '1.17.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.17.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'