iniziata modifica x decodifica status OSAI

This commit is contained in:
Samuele E. Locatelli
2018-11-22 23:09:25 +01:00
parent d2f0b0a2c2
commit 1bee78fe6b
2 changed files with 26 additions and 88 deletions
+23 -6
View File
@@ -1,4 +1,5 @@
using System;
using NLog;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
@@ -7,7 +8,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using NLog;
namespace IOB_UT
{
@@ -359,7 +359,7 @@ namespace IOB_UT
}
}
}
catch(Exception exc)
catch (Exception exc)
{
lg.Error(exc);
}
@@ -660,10 +660,10 @@ namespace IOB_UT
/// <returns></returns>
public static UInt32 SwapUInt32(UInt32 inValue)
{
return (UInt32)(((inValue & 0xff000000) >> 24) |
return ((inValue & 0xff000000) >> 24) |
((inValue & 0x00ff0000) >> 8) |
((inValue & 0x0000ff00) << 8) |
((inValue & 0x000000ff) << 24));
((inValue & 0x000000ff) << 24);
}
}
@@ -1120,8 +1120,25 @@ namespace IOB_UT
/// </summary>
SignIN
}
/// <summary>
/// Elenco modi CNC
/// Elenco STATI CNC OSAI
/// </summary>
public enum CNC_STATUS_OSAI
{
IDLE = 1,
CYCLE,
HODA,
RUNH,
HRUN,
ERRO,
WAIT,
RESET,
EMERG,
INPUT
}
/// <summary>
/// Elenco MODI CNC
/// </summary>
public enum CNC_MODE
{
+3 -82
View File
@@ -565,76 +565,8 @@ namespace IOB_WIN
{
TimingData.addResult(currIobConf.codIOB, "GETINFO1DATA", stopwatch.ElapsedTicks);
}
stopwatch.Stop();
stopwatch.Stop();
#if false
lgInfo(string.Format("Lettura completa NCINFO1DATA{0} lastNcError={1}{0}status={2}{0}substatus={9}{0}mode_select={3}{0}main_progr_name={4}{0}speed_ov={5}{0}progr_speed={6}{0}real_speed={7}{0}real_feed={8}{0}", Environment.NewLine, oData.last_nc_error, oData.status, oData.mode_select, oData.main_progr_name, oData.speed_ov, oData.progr_speed, oData.real_speed, oData.real_feed, oData.substatus));
#endif
#if false
// inizio letture, SEMPRE DA ZERO (possibile ottimizzazione...)
int memIndex = 0;
// controllo area R: se ha dati (> 0 byte) --> leggo!
if (MemBlockR.Length > 0)
{
stopwatch.Restart();
OsaiMemRW(R, FANUC.MemType.R, memIndex, ref MemBlockR);
if (utils.CRB("recTime"))
{
TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-R", MemBlockR.Length), stopwatch.ElapsedTicks);
}
// log
if (verboseLog)
{
for (int i = 0; i < MemBlockR.Length; i++)
{
lgInfo(string.Format("MemBlockR{0}: {1}", i, utils.binaryForm(MemBlockR[i])));
}
}
}
#endif
#if false
// controllo area X: se ha dati (> 0 byte) --> leggo!
if (MemBlockX.Length > 0)
{
stopwatch.Restart();
OsaiMemRW(R, FANUC.MemType.X, memIndex, ref MemBlockX);
if (utils.CRB("recTime"))
{
TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-X", MemBlockX.Length), stopwatch.ElapsedTicks);
}
// log
if (verboseLog)
{
for (int i = 0; i < MemBlockX.Length; i++)
{
lgInfo(string.Format("MemBlockX{0}: {1}", i, utils.binaryForm(MemBlockX[i])));
}
}
}
#endif
#if false
// controllo area Y: se ha dati (> 0 byte) --> leggo!
if (MemBlockY.Length > 0)
{
stopwatch.Restart();
OsaiMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlockY);
if (utils.CRB("recTime"))
{
TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-Y", MemBlockY.Length), stopwatch.ElapsedTicks);
}
// log
if (verboseLog)
{
for (int i = 0; i < MemBlockY.Length; i++)
{
lgInfo(string.Format("MemBlockY{0}: {1}", i, utils.binaryForm(MemBlockY[i])));
}
}
}
#endif
stopwatch.Stop();
// salvo il solo BYTE dell'input decifrando il semaforo...
decodeToBitmap();
}
@@ -711,13 +643,6 @@ namespace IOB_WIN
// registro contapezzi
lgInfo(string.Format("Contapezzi OSAI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi));
// 2018.06.26 NON resetto perché si deve resettare da solo da conteggio TC POST cambio ODL...
#if false
else if (contapezzi > lastCountCNC) // in questo caso resetto
{
contapezzi = lastCountCNC;
}
#endif
// invio a server contapezzi (aggiornato)
string retVal = utils.callUrl(urlSetPzCount + contapezzi.ToString());
// verifica se tutto OK
@@ -997,9 +922,6 @@ namespace IOB_WIN
try
{
// verifico modo con valore corrente, se cambia aggiorno...
#if true
CNC_MODE newMode = decodeModeOsai(oData.mode_select);
if (newMode != currMode)
{
@@ -1012,7 +934,6 @@ namespace IOB_WIN
// chiamo accodamento...
accodaFLog(sVal, qEncodeFLog("CNC_MODE", descrMode));
}
#endif
}
catch (Exception exc)
{
@@ -1036,7 +957,7 @@ namespace IOB_WIN
answ = CNC_MODE.MDI;
break;
case 2:
answ = CNC_MODE.AUTO;
answ = CNC_MODE.AUTO;
break;
case 3:
answ = CNC_MODE.SEMI;
@@ -1048,7 +969,7 @@ namespace IOB_WIN
answ = CNC_MODE.JOG_INC;
break;
case 6:
answ = CNC_MODE.PROFILE;
answ = CNC_MODE.PROFILE;
break;
case 7:
answ = CNC_MODE.HOME;