Aggiunto controllo connessione/disconnessione prima della lettura di FANUC e DOVREBEB (in caso di disconnesisone) gestire in modo corretto tentativo di riconnessione

This commit is contained in:
Samuele E. Locatelli
2018-03-30 16:01:41 +02:00
parent 8a7146fa59
commit 8ebf3dbf5c
3 changed files with 69 additions and 29 deletions
+35 -24
View File
@@ -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;
}
}
/// <summary>
/// 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;
}
}
}
+33 -4
View File
@@ -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<string, string> currSysInfo = new Dictionary<string, string>();
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<string, string> currDynData = new Dictionary<string, string>();
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<string, string> currOverride = new Dictionary<string, string>();
if (!DemoIn)
{
currOverride = getOverrides();
if (connectionOk)
{
currOverride = getOverrides();
}
else
{
lg.Error("Errore connessione mancante x getOverrides");
}
}
else
{
Vendored
+1 -1
View File
@@ -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'