Inserito valore default in configurazione parametri booleani SiemensOne

This commit is contained in:
Nicola Pievani
2024-09-12 16:47:36 +02:00
parent 3667ecb3b7
commit da4ddb2a7f
5 changed files with 90 additions and 6 deletions
+1
View File
@@ -129,6 +129,7 @@
Public Const K_SPOTLIGHT1 As String = "SpotLight1"
Public Const K_SPOTLIGHT2 As String = "SpotLight2"
Public Const K_NAXES As String = "nAxes"
Public Const K_RESETSTATUS As String = "ResetStatus"
' Nuove variabili
Public Const K_SPEEDHOLD As String = "SpeedHold"
Public Const K_XYJOG As String = "XYJog"
+35
View File
@@ -53,14 +53,43 @@ Public Class ManualAxesMoveUC
' Imposto check per considerare spessore lama
L1SawThChBx.IsChecked = m_MainWindow.m_CurrentMachine.bAddSawThTo5AxMove
L2SawThChBx.IsChecked = m_MainWindow.m_CurrentMachine.bAddSawThTo5AxMove
' Aggiorno visualizzazione
SetMachineInCurrPos()
EgtDraw()
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
End Sub
Private Sub ManualAxesMove_UnLoaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
m_Timer.Stop()
m_MainWindow.m_CurrentMachine.bAddSawThTo5AxMove = (L1SawThChBx.IsEnabled And L1SawThChBx.IsChecked) Or
(L2SawThChBx.IsEnabled And L2SawThChBx.IsChecked)
' Nascondo la macchina
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = False
EgtSetMachineLook(MCH_LOOK.TAB)
EgtDraw()
End Sub
Private Function SetMachineInCurrPos() As Boolean
' Recupero la posizione macchina
Dim dL1, dL2, dL3, dR1, dR2 As Double
If Not m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) Then Return False
' Recupero il nome degli assi macchina
Dim sL1 As String = String.Empty
Dim sL2 As String = String.Empty
Dim sL3 As String = String.Empty
Dim sR1 As String = String.Empty
Dim sR2 As String = String.Empty
If Not m_MainWindow.m_CNCommunication.GetAxesNames(sL1, sL2, sL3, sR1, sR2) Then Return False
' Visualizzo macchina in posizione
EgtSetAxisPos(sL1, dL1)
EgtSetAxisPos(sL2, dL2)
EgtSetAxisPos(sL3, dL3)
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
Return True
End Function
Private Sub UpdateAxesNames()
Dim sL1 As String = String.Empty
Dim sL2 As String = String.Empty
@@ -125,11 +154,16 @@ Public Class ManualAxesMoveUC
Private Sub Timer_tick()
UpdateAxesNames()
UpdateUseSawThickness()
' Aggiorno posizione macchina in disegno
SetMachineInCurrPos()
' Aggiorno il disegno
EgtDraw()
End Sub
Private m_MoveClicked As Boolean = False
Private Sub XXBtn_Click(sender As Object, e As MouseButtonEventArgs) Handles L1Btn.PreviewMouseDown, L2Btn.PreviewMouseDown, L3Btn.PreviewMouseDown, R1Btn.PreviewMouseDown, R2Btn.PreviewMouseDown
If e.ClickCount > 1 OrElse m_MoveClicked Then
EgtOutLog(" → Hold on! Do not click compulsively.")
Return
End If
m_MoveClicked = True
@@ -216,6 +250,7 @@ Public Class ManualAxesMoveUC
Private Sub SiemensMoveAxis(CurrentBtn As Button)
' leggo se stato reset
If Not m_CN.bResetState Then
EgtOutLog("Reset status is 'False', is denied to execute file '\DirectCmd\AxesMove.lua'.")
m_MoveClicked = False
Return
End If
+50 -4
View File
@@ -389,6 +389,9 @@ Public Class CNCommunication
m_CN.SetCnDataVar(CN_generico.CnData.VacuumOff, sVal)
GetPrivateProfileString(S_NCDATA, K_BYPASSTATE, "", sVal, m_MainWindow.GetMachIniFile())
m_CN.SetCnDataVar(CN_generico.CnData.BypassState, sVal)
' ver 2.6i1 : nuova gestione SiemensONE
GetPrivateProfileString(S_NCDATA, K_RESETSTATUS, "", sVal, m_MainWindow.GetMachIniFile())
m_CN.SetCnDataVar(CN_generico.CnData.ResetStatus, sVal)
' nuove variabili: stato dei nuovi pulsanti
nVal = GetPrivateProfileInt(S_NCDATA, K_NEWCONSOLE, 0, m_MainWindow.GetMachIniFile())
@@ -485,7 +488,12 @@ Public Class CNCommunication
End If
nVarType = VarType.TBoolean
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayBool)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayBool, ItemIndex, nVarType))
Dim NewRefFlafSiemens As RefereceFlagSimens = New RefereceFlagSimens(nIndexArrayBool, ItemIndex, nVarType)
If sItem.Count = 3 Then
' forzo la lettura della variabile di default (ignoro lo stato letto da CN)
NewRefFlafSiemens.DefaultValue = sItem(2)
End If
ListReferenceIndex.Add(NewRefFlafSiemens)
nIndexArrayBool += 1
Case 1
If nIndexArrayInt > 14 Then
@@ -540,7 +548,12 @@ Public Class CNCommunication
Next
nVarType = VarType.TInteger
m_CN.DVariables_Read_Subscription(sVarName, nVarType, nIndexArrayInt_1)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayInt_1, ItemIndex, nVarType, sIndexBit))
Dim NewRefFlafSiemens As RefereceFlagSimens = New RefereceFlagSimens(nIndexArrayInt_1, ItemIndex, nVarType, sIndexBit)
If sItem.Count = 3 Then
' forzo la lettura della variabile di default (ignoro lo stato letto da CN)
NewRefFlafSiemens.DefaultValue = sItem(2)
End If
ListReferenceIndex.Add(NewRefFlafSiemens)
If Not bFound Then
nIndexArrayInt += 1
ListIndexToVar.Add(New IndexArrayToBit(nIndexArrayInt_1, sVarName.Trim))
@@ -1214,6 +1227,7 @@ Public Class CNCommunication
Dim nFlag As Integer = ListReferenceIndex(IndxLst).FlagIndex
Dim nIndex As Integer = ListReferenceIndex(IndxLst).SiemnesArrayIndex
Dim nIndexBit As Integer = ListReferenceIndex(IndxLst).IndexBit
Dim sDefaultValue As String = ListReferenceIndex(IndxLst).DefaultValue
Dim b_temp As Boolean = False
Dim n_temp As Integer = 0
Dim l_temp As Long = 0.0
@@ -1221,11 +1235,31 @@ Public Class CNCommunication
' leggo il valore caricato
Select Case nType
Case VarType.TBoolean
b_temp = m_CN.b_data(nIndex)
If Not String.IsNullOrEmpty(sDefaultValue) Then
' ver 2.6i1
Try
b_temp = CBool(sDefaultValue)
Catch ex As Exception
EgtOutLog("Default boolean value of flag " & nFlag.ToString & " is not Boolean, verify the form: True or true or 1, False or false or 0")
b_temp = m_CN.b_data(nIndex)
End Try
Else
b_temp = m_CN.b_data(nIndex)
End If
Case VarType.TInteger
n_temp = m_CN.n_data(nIndex)
' VENTOSE: lettura dato da intero Bit a Bit (ver_2.6h1), ritorno un Boolean
b_temp = ReadBit(nIndexBit, n_temp)
If Not String.IsNullOrEmpty(sDefaultValue) Then
' ver 2.6i1
Try
b_temp = CBool(sDefaultValue)
Catch ex As Exception
EgtOutLog("Default bit value of flag " & nFlag.ToString & " is not Boolean, verify the form: True or true or 1, False or false or 0")
b_temp = ReadBit(nIndexBit, n_temp)
End Try
Else
b_temp = ReadBit(nIndexBit, n_temp)
End If
Case VarType.TLong
l_temp = m_CN.l_data(nIndex)
Case VarType.TDouble
@@ -1343,6 +1377,8 @@ Public Class CNCommunication
Case CN_generico.CnData.nAxes ' (55)
m_CN.n_index_is_G24_active = nIndex
m_CN.b5AxesState = b_temp
Case CN_generico.CnData.ResetStatus ' (56)
m_CN.bResetState = b_temp
End Select
Next
@@ -1673,6 +1709,7 @@ Public Class RefereceFlagSimens
Private m_TypeArray As Integer
' Opzionale
Private m_IndexBit As Integer = -1
Private m_DefaultValue As String = ""
Public Property SiemnesArrayIndex As Integer
Get
@@ -1710,6 +1747,15 @@ Public Class RefereceFlagSimens
End Set
End Property
Public Property DefaultValue As String
Get
Return m_DefaultValue
End Get
Set(value As String)
m_DefaultValue = value
End Set
End Property
Sub New(IndArray As Integer, Flag As Integer, nType As Integer)
m_SiemnesArrayIndex = IndArray
m_FlagIndex = Flag
+3 -1
View File
@@ -8,7 +8,7 @@ Public MustInherit Class CN_generico
Public Const MAX_VAR As Short = 100
Public Const MAX_VALUES As Short = 9 ' Max. index to read the data from the FXServer array
Public Const MAX_TOOLS As Short = 100
Public Const NUM_DATA = 56 ' Numero di dati del CN (Speed,Feed,...)
Public Const NUM_DATA = 57 ' Numero di dati del CN (Speed,Feed,...)
Public m_NewVariable As Boolean = False ' per scrittura delle vairbaili Apllication del PLC
@@ -72,6 +72,8 @@ Public MustInherit Class CN_generico
EnablePC = 54
nAxes = 55
ResetStatus = 56
End Enum
Public Enum Type As Short
+1 -1
View File
@@ -523,7 +523,7 @@ Public Class CurrentProjectPageUC
' Sistemazioni finali
If nAddTabId = GDB_ID.NULL Then Return False
EgtSetName(nAddTabId, MACH_ADD_TABLE)
EgtSetColor(nAddTabId, New Color3d(150, 75, 0, 100), True)
If nRefAddTabId = GDB_ID.NULL Then EgtSetColor(nAddTabId, New Color3d(150, 75, 0, 100), True)
EgtSetInfo(nAddTabId, KEY_ADD_TABLE, dAddTable)
Return True
End Function