diff --git a/Constants/ConstMachIni.vb b/Constants/ConstMachIni.vb index 5130c3b..511cab8 100644 --- a/Constants/ConstMachIni.vb +++ b/Constants/ConstMachIni.vb @@ -107,6 +107,7 @@ Public Const K_ZBJOG As String = "ZBJog" Public Const K_POWERON As String = "PowerON" Public Const K_POWEROFF As String = "PowerOFF" + Public Const K_REMOTE As String = "Remote" Public Const S_PRODUCTIONLINE As String = "ProductionLine" Public Const K_ACTIVE As String = "Active" diff --git a/DirectCuts/DirectCutPageUC.xaml b/DirectCuts/DirectCutPageUC.xaml index 178ecde..0cda284 100644 --- a/DirectCuts/DirectCutPageUC.xaml +++ b/DirectCuts/DirectCutPageUC.xaml @@ -97,7 +97,8 @@ - + + @@ -124,13 +125,18 @@ - - + - - + + - diff --git a/DirectCuts/DirectCutPageUC.xaml.vb b/DirectCuts/DirectCutPageUC.xaml.vb index 1ea5984..9d9635a 100644 --- a/DirectCuts/DirectCutPageUC.xaml.vb +++ b/DirectCuts/DirectCutPageUC.xaml.vb @@ -119,11 +119,16 @@ Public Class DirectCutPageUC Dim x As Integer = GetPrivateProfileInt(S_NCDATA, K_NEWCONSOLE, 0, m_MainWindow.GetMachIniFile()) If GetPrivateProfileInt(S_NCDATA, K_NEWCONSOLE, 0, m_MainWindow.GetMachIniFile()) = 1 And Not bCollapsedNewBottonsConsole Then XYBtn.Content = "X - Y" + XYBtn.Foreground = Brushes.White ZCBtn.Content = "Z - C" + ZCBtn.Foreground = Brushes.White If AxesNumber < 5 Then ZBBtn.Visibility = Windows.Visibility.Collapsed End If ZBBtn.Content = "Z - B" + ZBBtn.Foreground = Brushes.White + RemoteBtn.Content = "Remote" + RemoteBtn.Foreground = Brushes.White Else XYBtn.Visibility = Windows.Visibility.Collapsed ZCBtn.Visibility = Windows.Visibility.Collapsed @@ -383,6 +388,35 @@ Public Class DirectCutPageUC ZBBtn.IsChecked = bBCAxes End If End Sub + + Private Sub RemoteBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemoteBtn.Click + Dim RemoteButton As MachineButton = m_ButtonJogList(3) + ' eseguo lo script lua associato + Dim CurrentBtn As Primitives.ToggleButton = e.Source + Dim sLuaFileName As String = String.Empty + If CurrentBtn.IsChecked() Then + sLuaFileName = RemoteButton.TLuaScriptName + Else + sLuaFileName = RemoteButton.FLuaScriptName + End If + RemoteButton.ExecuteMDICommand(sLuaFileName) + End Sub + + Friend Sub RemoteChanged(bRemote As Boolean) + ' devo decodificare il tipo di pulsante, quindi eseguire la conversione... + Dim RemoteButton As TwoStateButton = Nothing + For Each MachineButton As MachineButton In m_ButtonJogList + If MachineButton.StateFlag.Trim = K_REMOTE Then + RemoteButton = MachineButton + Exit For + End If + Next + If Not IsNothing(RemoteButton) Then + RemoteButton.SetIsChecked(bRemote) + RemoteBtn.IsChecked = bRemote + End If + End Sub + '------------------NUOVI BOTTONI PER GESTIONE JOYSTICK------------------------------------------------- Private Sub MachViewModeBtn_Click(sender As Object, e As RoutedEventArgs) Handles MachViewModeBtn.Click If m_bShowMachine Then diff --git a/DirectCuts/MachineButtonsUC.xaml.vb b/DirectCuts/MachineButtonsUC.xaml.vb index 4b1fff7..43dbf51 100644 --- a/DirectCuts/MachineButtonsUC.xaml.vb +++ b/DirectCuts/MachineButtonsUC.xaml.vb @@ -121,6 +121,8 @@ Public Class MachineButtonsUC CurrToggleBtn.Content = "Z - C" ElseIf StateFlagArray(nIndex) = K_ZBJOG Then CurrToggleBtn.Content = "Z - B" + ElseIf StateFlagArray(nIndex) = K_REMOTE Then + CurrToggleBtn.Content = "Remote" End If Catch ex As Exception EgtOutLog("Error loading content " & StateFlagArray(nIndex)) @@ -602,6 +604,15 @@ Public Class MachineButtonsUC ' selezoiono lo stato del bottone GetToggleButton(nIndex + 1).IsChecked = bBCAxes End Sub + + Friend Sub RemoteChanged(ByVal bRemote As Boolean) + ' recupero le asscociazioni con i bottoni + Dim nIndex As Integer = Array.IndexOf(StateFlagArray, K_REMOTE) + If nIndex = -1 Then Return + ' selezoiono lo stato del bottone + GetToggleButton(nIndex + 1).IsChecked = bRemote + End Sub + '----------------------------------------------------------------------------------------------------------------- Private Function GetToggleButton(ByVal nIndex As Integer) As Primitives.ToggleButton diff --git a/NcComm/CNCommunication.vb b/NcComm/CNCommunication.vb index 696b92e..8d06ceb 100644 --- a/NcComm/CNCommunication.vb +++ b/NcComm/CNCommunication.vb @@ -336,6 +336,8 @@ Public Class CNCommunication m_CN.SetCnDataVar(CN_generico.CnData.ZBJog, sVal) GetPrivateProfileString(S_NCDATA, K_POWERON, "", sVal, m_MainWindow.GetMachIniFile()) m_CN.SetCnDataVar(CN_generico.CnData.PowerON, sVal) + GetPrivateProfileString(S_NCDATA, K_REMOTE, "", sVal, m_MainWindow.GetMachIniFile()) + m_CN.SetCnDataVar(CN_generico.CnData.Remote, sVal) End If ' Inizializzo la comunicazione @@ -558,6 +560,7 @@ Public Class CNCommunication m_MainWindow.m_DirectCutPageUC.XYJogChanged(m_CN.bXYJog) m_MainWindow.m_DirectCutPageUC.ZCJogChanged(m_CN.bZCJog) m_MainWindow.m_DirectCutPageUC.ZBJogChanged(m_CN.bZBCJog) + m_MainWindow.m_DirectCutPageUC.RemoteChanged(m_CN.bRemote) End If Else m_MainWindow.m_DirectCutPageUC.m_MachineButtons.SpindleStateChanged(m_CN.bSpindleState) @@ -578,6 +581,7 @@ Public Class CNCommunication m_MainWindow.m_DirectCutPageUC.m_MachineButtons.XYJogChanged(m_CN.bXYJog) m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ZJogChanged(m_CN.bZCJog) m_MainWindow.m_DirectCutPageUC.m_MachineButtons.BCJogChanged(m_CN.bZBCJog) + m_MainWindow.m_DirectCutPageUC.m_MachineButtons.RemoteChanged(m_CN.bRemote) End If End If diff --git a/NcComm/CN_generico.vb b/NcComm/CN_generico.vb index 5e92ee5..655f734 100644 --- a/NcComm/CN_generico.vb +++ b/NcComm/CN_generico.vb @@ -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 = 51 ' Numero di dati del CN (Speed,Feed,...) + Public Const NUM_DATA = 52 ' Numero di dati del CN (Speed,Feed,...) Public m_NewVariable As Boolean = False ' per scrittura delle vairbaili Apllication del PLC @@ -65,6 +65,7 @@ Public MustInherit Class CN_generico ZCJog = 48 ZBJog = 49 PowerON = 50 + Remote = 51 End Enum #End Region @@ -205,6 +206,7 @@ Public MustInherit Class CN_generico Public bZBCJog As Boolean Public bPowerON As Boolean + Public bRemote As Boolean ' Nuovi di bottoni ------------------------------------------- Public nMachineMode As Integer diff --git a/NcComm/M_Num.vb b/NcComm/M_Num.vb index 107fe9d..0a1f50e 100644 --- a/NcComm/M_Num.vb +++ b/NcComm/M_Num.vb @@ -1085,6 +1085,8 @@ Namespace Num bZBCJog = CBool(values(n)) Case CnData.PowerON ' (49) bPowerON = CBool(values(n)) + Case CnData.Remote ' (50) + bRemote = CBool(values(n)) End Select Next