Fix lettura multi G-code x OSAI

This commit is contained in:
Samuele E. Locatelli
2017-06-28 10:30:27 +02:00
parent c184162359
commit bf4ff0ccf8
6 changed files with 544 additions and 1051 deletions
@@ -893,8 +893,13 @@ Namespace CNC
Public Overridable Function getAllAxisPos(tipoPos As Int16, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
Return True
End Function
Public Overridable Function getPathGCodeMod(ByRef GCodeCurr As UShort()) As Boolean
''' <summary>
''' Elenco codici G del processo richiesto...
''' </summary>
''' <param name="Processo"></param>
''' <param name="GCodeCurr"></param>
''' <returns></returns>
Public Overridable Function getPathGCodeMod(Processo As Int32, ByRef GCodeCurr As UShort()) As Boolean
Return True
End Function
@@ -1038,23 +1038,24 @@ Retry: nRetry += 1
End Try
End Function
Public Overloads Overrides Function getPathGCodeMod(ByRef GCodeCurr As UShort()) As Boolean
Public Overloads Overrides Function getPathGCodeMod(Processo As Int32, ByRef GCodeCurr As UShort()) As Boolean
' RIFERIMENTO:
' CndexLinkUser.pdf | pag 165
Dim szReturn As String = ""
Dim myGetGCodeR As OPENcontrol.GetGCodeR
Dim myGetGCode As New OPENcontrol.GetGCode
Dim ProcessId As Short
Dim ProcessId As UShort
Dim nRetry As Integer
Retry: nRetry += 1
Try
O_GetSelectedProcess(ProcessId)
myGetGCode.ProcNum = ProcessId
'myGetGCode.ProcNum = ProcessId
myGetGCode.ProcNum = Processo
myGetGCodeR = OPENws.GetGCode(myGetGCode)
If O_CheckRetError(myGetGCodeR.retval, myGetGCodeR.ErrClass, myGetGCodeR.ErrNum, "ReadCurrentAnomalyMsg() O_ReadCurrentAnomalyMsg CNC.OSAI_OPEN", szReturn) Then
If O_CheckRetError(myGetGCodeR.retval, myGetGCodeR.ErrClass, myGetGCodeR.ErrNum, "ReadCurrentGCodes() O_ReadCurrentGCodes CNC.OSAI_OPEN", szReturn) Then
Throw New CmsNcException(szReturn)
Return False
End If
+22 -17
View File
@@ -879,24 +879,9 @@ namespace MTC_Adapter
public override void getPath()
{
// recupero vettore generale G MODE
parentForm.commPlcActive = true;
inizio = DateTime.Now;
ushort[] vettGCodes = new ushort[14];
OSAI_ref.getPathGCodeMod(ref vettGCodes);
if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
parentForm.commPlcActive = false;
// attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535
string GCodAttivi = "";
for (int i = 0; i < vettGCodes.Length; i++)
{
// se il valore è < di UShort.max (65535)...
if (vettGCodes[i] < ushort.MaxValue)
{
GCodAttivi += string.Format("[G{0}]", vettGCodes[i]);
}
}
// NON ci sono nella documentazione metodi x recuperare posizione PuntaUtensile, in attesa news da OSAI/Andrea...
#if false
@@ -917,6 +902,26 @@ namespace MTC_Adapter
sb_2 = new StringBuilder();
sb_3 = new StringBuilder();
// recupero vettore generale G MODE
parentForm.commPlcActive = true;
inizio = DateTime.Now;
ushort[] vettGCodes = new ushort[14];
OSAI_ref.getPathGCodeMod(i + 1, ref vettGCodes);
if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
parentForm.commPlcActive = false;
// attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535
string GCodAttivi = "";
for (int j = 0; j < vettGCodes.Length; j++)
{
// se il valore è < di UShort.max (65535)...
if (vettGCodes[j] < ushort.MaxValue)
{
GCodAttivi += string.Format("[G{0}]", vettGCodes[j]);
}
}
vettPath[i].mPathCodG_Act.Value = GCodAttivi;
#if false
+2 -2
View File
@@ -38,9 +38,9 @@
ipPLC = "192.168.139.1"-->
<!--<add key="ipPLC" value="192.168.157.2"/>-->
<!--OSAI DEV-->
<!--<add key ="ipPLC" value="192.168.157.2" />-->
<add key ="ipPLC" value="192.168.157.2" />
<!--CMS PROD-->
<add key ="ipPLC" value="192.168.139.1" />
<!--<add key ="ipPLC" value="192.168.139.1" />-->
<add key="recTime" value="true"/>
<add key="verbose" value="true"/>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<AdapterConf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Version>1</Version>
<NomeAdapt>ADAPTER_FANUC</NomeAdapt>
<TipoAdapt>FANUC</TipoAdapt>
<NomeAdapt>ADAPTER_OSAI</NomeAdapt>
<TipoAdapt>OSAI</TipoAdapt>
<ContOreMaccOn>0</ContOreMaccOn>
<ContOreMaccLav>0</ContOreMaccLav>
<ContSlittaTast>0</ContSlittaTast>
@@ -81,6 +81,10 @@
<ident>Path_01</ident>
<dataRefList />
</element>
<element>
<ident>Path_02</ident>
<dataRefList />
</element>
</Path>
<UnOp>
<element>
File diff suppressed because it is too large Load Diff