Fanuc TT
& alarm Fixes
This commit is contained in:
@@ -24,10 +24,52 @@ public static class ThreadsFunctions
|
||||
private static long ReadAxesNamesTimer = 0, ReadAxesNamesTimes = 0;
|
||||
private static long ReadHeadsTimer = 0, ReadHeadsTimes = 0;
|
||||
private static long ReadToolDataTimer = 0, ReadToolDataTimes = 0;
|
||||
private static long WatchdogTimer = 0, WatchdogTimes = 0;
|
||||
|
||||
|
||||
private static Thread ConnThread;
|
||||
|
||||
#region Nc functions threads
|
||||
#region Functions
|
||||
|
||||
public static void ManageWatchdog()
|
||||
{
|
||||
NcHandler ncHandler = new NcHandler();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
|
||||
try
|
||||
{
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
// Check if client is connected
|
||||
if (ncHandler.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Manage watchdog
|
||||
libraryError = ncHandler.ManageWatchdog();
|
||||
}
|
||||
else
|
||||
TryNcConnection();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
//Update thread timer
|
||||
WatchdogTimer += sw.ElapsedMilliseconds;
|
||||
WatchdogTimes++;
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
ncHandler.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadAlarms()
|
||||
{
|
||||
@@ -115,7 +157,6 @@ public static class ThreadsFunctions
|
||||
}
|
||||
}
|
||||
|
||||
// Read processes part program status
|
||||
public static void ReadProcessesPPStatus()
|
||||
{
|
||||
NcHandler ncHandler = new NcHandler();
|
||||
@@ -157,7 +198,6 @@ public static class ThreadsFunctions
|
||||
MessageServices.Current.Publish(SEND_NC_SOFTKEYS_DATA, null, ncSoftKeys);
|
||||
// Send m155 through signalR
|
||||
MessageServices.Current.Publish(SEND_M155_DATA, null, m155Data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,7 +499,7 @@ public static class ThreadsFunctions
|
||||
try
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
CmsError libraryError = ncHandler.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
@@ -675,7 +715,7 @@ public static class ThreadsFunctions
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Nc functions threads
|
||||
#endregion Functions
|
||||
|
||||
#region SupportFunctions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user