OmagCUT 2.1a2 :

- ricompilazione con VS2017
- aggiunto timeout in comunicazione con Siemens.
This commit is contained in:
Dario Sassi
2019-01-17 16:29:55 +00:00
parent 1d817bbaf4
commit 2cd89bdc3a
3 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ Public Class CNCommunication
#End If
EgtOutLog("NcLink=" & m_MainWindow.m_bNCLink.ToString & " type=" & m_nNCType)
' Se CNSiemens leggo dati programma intermedio di comunicazione
' Se CN Siemens leggo dati programma intermedio di comunicazione
If m_nNCType = 3 Then
Dim sExeName As String = String.Empty
GetPrivateProfileString(S_NCSIEMENS, K_COMM_NAME, "", sExeName, m_MainWindow.m_CurrentMachine.sMachIniFile)
+18 -18
View File
@@ -213,9 +213,7 @@ Module M_MMFiles
MapSize, _
FullMapName)
If (hMapFile.IsInvalid) Then
Throw New Win32Exception
End If
If hMapFile.IsInvalid Then Throw New Win32Exception
' Create the file mapping object2 .
hMapFile2 = NativeMethod.CreateFileMapping( _
@@ -226,9 +224,7 @@ Module M_MMFiles
MapSize, _
FullMapName2)
If (hMapFile2.IsInvalid) Then
Throw New Win32Exception
End If
If hMapFile2.IsInvalid Then Throw New Win32Exception
' Map a view of the file mapping into the address space of the current process.
@@ -239,9 +235,7 @@ Module M_MMFiles
ViewOffset, _
ViewSize)
If (pView = IntPtr.Zero) Then
Throw New Win32Exception
End If
If pView = IntPtr.Zero Then Throw New Win32Exception
' Map a view of the file mapping into the address space of the current process.
@@ -252,9 +246,7 @@ Module M_MMFiles
ViewOffset, _
ViewSize)
If (pView = IntPtr.Zero) Then
Throw New Win32Exception
End If
If pView2 = IntPtr.Zero Then Throw New Win32Exception
Catch ex As Exception
EgtOutLog("Errore nell'init dell'm_mmFiles")
@@ -482,6 +474,7 @@ Module M_MMFiles
Try
' Attesa eventuale busy iniziale
Dim nCount As Integer = 0
Dim bEnd As Boolean = False
While Not bEnd
If SiemensRet.b_busy Then
@@ -489,6 +482,9 @@ Module M_MMFiles
Else
bEnd = True
End If
' controllo massimo numero di cicli
nCount += 1
If nCount > 40 Then Throw New Win32Exception("Timeout")
End While
' Alzo il comando
@@ -498,6 +494,7 @@ Module M_MMFiles
' Ciclo di attesa della risposta
Dim nState As State = State.Command_on
nCount = 0
bEnd = False
While Not bEnd
Select Case nState
@@ -512,22 +509,25 @@ Module M_MMFiles
' scrivo !!!!!
Marshal.StructureToPtr(SiemensSend, pView, False)
nState = State.Command_off
Case State.Command_off
If Not SiemensRet.b_busy Then ' abbassato il comando attendo il busy basso
nState = State.Busy_Off
Else
Case State.Command_off ' abbassato il comando attendo il busy basso
If SiemensRet.b_busy Then
System.Threading.Thread.Sleep(50)
Else
nState = State.Busy_Off
End If
Case State.Busy_Off
bEnd = True
End Select
' controllo massimo numero di cicli
nCount += 1
If nCount > 400 Then Throw New Win32Exception("Timeout")
End While
'EgtOutLog("Eseguito comando :" & SiemensSend.n_Command.ToString())
Catch ex As Exception
EgtOutLog("Errore nell'esecuzione di un comando :" & ex.ToString())
SiemensRet.n_result = 99
EgtOutLog("Errore nell'esecuzione di un comando : " & ex.Message)
End Try
End Sub
+4 -4
View File
@@ -22,7 +22,7 @@ Imports System.Windows
#End If
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
<Assembly: AssemblyProduct("OmagCUT")>
<Assembly: AssemblyCopyright("Copyright © 2015-2018 by EgalTech s.r.l.")>
<Assembly: AssemblyCopyright("Copyright © 2015-2019 by EgalTech s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
@@ -49,7 +49,7 @@ Imports System.Windows
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("5f7e2879-e4a4-430d-bcf2-f9a3724762be")>
<Assembly: Guid("5f7e2879-e4a4-430d-bcf2-f9a3724762be")>
' Version information for an assembly consists of the following four values:
'
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.9.12.3")>
<Assembly: AssemblyFileVersion("1.9.12.3")>
<Assembly: AssemblyVersion("2.1.1.2")>
<Assembly: AssemblyFileVersion("2.1.1.2")>