Da completare ma apparentemente abbozzato

This commit is contained in:
2017-10-18 18:53:04 +02:00
parent 12d86ccc6c
commit fc3286f49d
4 changed files with 161 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ CNCTYPE=FANUC
IDXMACC=999
[CNC]
IP=127.0.0.1
IP=192.168.139.1
PORT=8193
[SERVER]
+55
View File
@@ -42,6 +42,61 @@ namespace IOB_WIN
/// Ultimo valore watchdog rilevato
/// </summary>
public bool lastWatchDog = false;
// 16 byte di strobe (4 word da 32 bit di flags...)
public byte[] Strobes = new byte[16];
/// <summary>
/// Prima word di strobe da array flag completo
/// </summary>
public StFlag32 STRB_DW0
{
get
{
return (StFlag32)BitConverter.ToUInt32(Strobes, 0);
}
}
/// <summary>
/// Seconda word di strobe da array flag completo
/// </summary>
public StFlag32 STRB_DW1
{
get
{
return (StFlag32)BitConverter.ToUInt32(Strobes, 4);
}
}
/// <summary>
/// Terza word di strobe da array flag completo
/// </summary>
public StFlag32 STRB_DW2
{
get
{
return (StFlag32)BitConverter.ToUInt32(Strobes, 8);
}
}
/// <summary>
/// Quarta word di strobe da array flag completo
/// </summary>
public StFlag32 STRB_DW3
{
get
{
return (StFlag32)BitConverter.ToUInt32(Strobes, 12);
}
}
/// <summary>
/// Quarta word di strobe da array flag completo
/// </summary>
public StFlag32 STRB_DW4
{
get
{
return (StFlag32)BitConverter.ToUInt32(Strobes, 16);
}
}
/// <summary>
/// Determina se utilizzare blocchi di memoria IOT contigui (e quindi processing "monoblocco" semplificato"=
/// </summary>
+4
View File
@@ -64,6 +64,10 @@
this.gbMonitor.SuspendLayout();
this.SuspendLayout();
//
// gather
//
this.gather.Tick += new System.EventHandler(this.gather_Tick);
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+101
View File
@@ -342,6 +342,107 @@ namespace IOB_WIN
#region gestione metodi specifici FORM
/// <summary>
/// Avanza la barra di stato...
/// </summary>
public void advProgBar()
{
try
{
MainProgrBar.PerformStep();
MainProgrBar.Invalidate();
}
catch
{ }
}
private void checkNormTask()
{
// decremento...
normCount--;
// se il counter è a zero eseguo...
if (normCount <= 0)
{
normCount = utils.CRI("normCount");
// avvio fase raccolta dati e invio con adapter
iobObj.gaterAndSend(gatherCycle.MF);
}
}
private void checkFastTask()
{
// decremento...
fastCount--;
// se il counter è a zero eseguo...
if (fastCount <= 0)
{
fastCount = utils.CRI("fastCount");
// avvio fase raccolta dati e invio con adapter
iobObj.gaterAndSend(gatherCycle.HF);
refreshVisualStrobes();
}
}
private void refreshVisualStrobes()
{
// aggiorno visualizzazione strobe!
STATUS_STRB_DW0.Text = utils.binaryForm((int)iobObj.STRB_DW0);
}
private void gather_Tick(object sender, EventArgs e)
{
// eseguo cicli attivi SOLO se adapter è in EFFETTIVO running...
if (iobObj.adpRunning)
{
// inizio a riportare che sto eseguendo..
advProgBar();
if (iobObj.connectionOk)
{
// check esecuzione FastTask
checkFastTask();
// check esecuzione NormTask
checkNormTask();
#if false
// check esecuzione SlowTask
checkSlowTask();
// check esecuzione AlarmSync
checkAlarmSync();
// check esecuzione SendTask (VHF)
checkSendTask();
#endif
if (utils.CRI("waitEndCycle") > 0)
{
Thread.Sleep(utils.CRI("waitEndCycle"));
}
}
else
{
double currWait = DateTime.Now.Subtract(lastStartTry).TotalMilliseconds;
if (iobObj.adpTryRestart && currWait > utils.CRI("waitRecMSec"))
{
lastStartTry = DateTime.Now;
iobObj.tryConnect();
iobObj.loadPersData();
}
}
// se è arrivato a MAX resetto...
if (MainProgrBar.Value >= MainProgrBar.Maximum)
{
MainProgrBar.Value = 0;
}
}
else
{
// verifico SE debba tentare il riavvio, ovvero NON running ma tryReconn e non ho riprovato x oltre waitRecMSec
double currWait = DateTime.Now.Subtract(lastStartTry).TotalMilliseconds;
if (iobObj.adpTryRestart && currWait > utils.CRI("waitRecMSec"))
{
lastStartTry = DateTime.Now;
avviaAdapter();
iobObj.loadPersData();
}
}
}
/// <summary>
/// Chiusura adapter
/// </summary>