Skip to content
This repository has been archived by the owner on Apr 7, 2019. It is now read-only.

Commit

Permalink
V1.0.9.10
Browse files Browse the repository at this point in the history
- Fix send of tool offset setting, Issue #79
- Expand Macro editing box, Issue #80
- Add indicator colour when Overrides active, Issue #80
- Add Grbl/GrblPanel version info to Settings page, Issue #80
- Add Single Step to file panel, Issue #80, Issue #23
  • Loading branch information
gerritv committed Dec 15, 2016
1 parent 68d6e32 commit 41ab58c
Show file tree
Hide file tree
Showing 17 changed files with 6,965 additions and 3,630 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ _ReSharper*/
[Tt]est[Rr]esult*
.vs/

/Grbl-Panel/*.user
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
This file documents changes made:
V1.0.9.10 - 2016 Dec 15
- Fix send of tool offset setting, Issue #79
- Expand Macro editing box, Issue #80
- Add indicator colour when Overrides active, Issue #80
- Add Grbl/GrblPanel version info to Settings page, Issue #80
- Add Single Step to file panel, Issue #80, Issue #23
V1.0.9.9 - 2016 Dec 12
- Add Laser Mode text to Settings list, Issue 71
- Fix revision, Issue 77
Expand Down
6 changes: 6 additions & 0 deletions Grbl-Panel/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
This file documents changes made:
V1.0.9.10 - 2016 Dec 15
- Fix send of tool offset setting, Issue #79
- Expand Macro editing box, Issue #80
- Add indicator colour when Overrides active, Issue #80
- Add Grbl/GrblPanel version info to Settings page, Issue #80
- Add Single Step to file panel, Issue #80, Issue #23
V1.0.9.9 - 2016 Dec 12
- Add Laser Mode text to Settings list, Issue 71
- Fix revision, Issue 77
Expand Down
3 changes: 3 additions & 0 deletions Grbl-Panel/Grbl-Panel.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
<Compile Include="GrblGcodeView.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="GrblInfo.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="GrblMacroButtons.vb">
<SubType>Form</SubType>
</Compile>
Expand Down
2 changes: 0 additions & 2 deletions Grbl-Panel/Grbl-Panel.vbproj.DotSettings.user

This file was deleted.

6 changes: 0 additions & 6 deletions Grbl-Panel/Grbl-Panel.vbproj.user

This file was deleted.

112 changes: 71 additions & 41 deletions Grbl-Panel/GrblGcode.vb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Partial Class GrblGui
Private _gui As GrblGui
Private _wtgForAck As Boolean = False '
Private _runMode As Boolean = True '
Private _stepMode As Boolean = False ' for single stepping gcode
Private _sendAnotherLine As Boolean = False '
Private _lineCount As Integer = 0 ' No of lines left to send
Private _linesDone As Integer = 0
Expand Down Expand Up @@ -139,9 +140,20 @@ Partial Class GrblGui
' Resume sending of file
_sendAnotherLine = True
_runMode = True
_stepMode = False
gcodeview.fileMode = True
_gui.processLineEvent("") ' Prime the pump again

End Sub

Public Sub sendGCodeFileStep()
' Single Step Line from file
_sendAnotherLine = True
_runMode = False
_stepMode = True
_gui.gcodeview.fileMode = True
_gui.processLineEvent("") ' Prime the pump again

End Sub
Public Sub sendGCodeFileStop()

Expand Down Expand Up @@ -235,6 +247,14 @@ Partial Class GrblGui
_wtgForAck = value
End Set
End Property
Property stepMode() As Boolean
Get
Return _stepMode
End Get
Set(value As Boolean)
_stepMode = value
End Set
End Property
Property sendAnotherLine() As Boolean
Get
Return _sendAnotherLine
Expand Down Expand Up @@ -304,50 +324,50 @@ Partial Class GrblGui
End If
End If
End If
' Do we have another line to send?
If gcode.runMode = True Then ' if not paused or stopped
If gcode.sendAnotherLine Then
gcode.sendAnotherLine = False
' if count > 0
If gcode.lineCount > 0 Then
Dim line As String
' Read another line
line = gcodeview.readGcode(gcode.lineCount, gcode.linesDone)
If Not line.StartsWith("EOF") Then ' We never hit this but is here just in case the file gets truncated
' count - 1
gcode.lineCount -= 1
' show as sent
gcodeview.UpdateGcodeSent(gcode.linesDone) ' Mark line as sent
gcode.linesDone += 1
lblCurrentLine.Text = gcode.linesDone.ToString ' Issue #60
state.ProcessGCode(line)
' Set Message if it starts with (
If line.StartsWith("(") Then
Dim templine As String = line
templine = templine.Remove(0, 1)
templine = templine.Remove(templine.Length - 1, 1)
tbGCodeMessage.Text = templine
End If
If line.StartsWith("m30") Or line.StartsWith("M30") Then
' Set M30 flag to rewind on 'ok'
gcode.m30Flag = True
End If
' Remove all whitespace
line = line.Replace(" ", "")
' set wtg for Ack
gcode.wtgForAck = True
' Ship it Dano!
grblPort.sendData(line)
' Do we have another line to send?
If gcode.runMode = True Or gcode.stepMode = True Then ' if not paused or stopped
If gcode.sendAnotherLine Then
gcode.sendAnotherLine = False
' if count > 0
If gcode.lineCount > 0 Then
Dim line As String
' Read another line
line = gcodeview.readGcode(gcode.lineCount, gcode.linesDone)
If Not line.StartsWith("EOF") Then ' We never hit this but is here just in case the file gets truncated
' count - 1
gcode.lineCount -= 1
' show as sent
gcodeview.UpdateGcodeSent(gcode.linesDone) ' Mark line as sent
gcode.linesDone += 1
lblCurrentLine.Text = gcode.linesDone.ToString ' Issue #60
state.ProcessGCode(line)
' Set Message if it starts with (
If line.StartsWith("(") Then
Dim templine As String = line
templine = templine.Remove(0, 1)
templine = templine.Remove(templine.Length - 1, 1)
tbGCodeMessage.Text = templine
End If
If line.StartsWith("m30") Or line.StartsWith("M30") Then
' Set M30 flag to rewind on 'ok'
gcode.m30Flag = True
End If
Else
' We reached the EOF aka linecount=0, yippee
gcode.sendGCodeFileStop()
' Remove all whitespace
line = line.Replace(" ", "")
' set wtg for Ack
gcode.wtgForAck = True
' Ship it Dano!
grblPort.sendData(line)
End If
Else
' We reached the EOF aka linecount=0, yippee
gcode.sendGCodeFileStop()
End If
End If
' Check for status responses that we need to handle here
' Extract status
Dim status = Split(data, ",")
End If
' Check for status responses that we need to handle here
' Extract status
Dim status = Split(data, ",")
If status(0) = "<Alarm" Or status(0).StartsWith("ALARM") Then
' Major problem so cancel the file
' GrblStatus has set the Alarm indicator etc
Expand All @@ -368,7 +388,7 @@ Partial Class GrblGui
End Sub

Private Sub btnFileGroup_Click(sender As Object, e As EventArgs) Handles btnFileSend.Click, btnFileSelect.Click, btnFilePause.Click, btnFileStop.Click,
btnFileReload.Click
btnFileReload.Click, btnFileStep.Click
' This event handler deals with the gcode file related buttons
' Implements a simple state machine to keep user from clicking the wrong buttons
' Uses button.tag instead of .text so the text doesn't mess up the images on the buttons
Expand All @@ -391,6 +411,7 @@ Partial Class GrblGui

btnFileSelect.Enabled = True ' Allow changing your mind about the file
btnFileSend.Enabled = True
btnFileStep.Enabled = True
btnFilePause.Enabled = False
btnFileStop.Enabled = False
btnFileReload.Enabled = False
Expand All @@ -408,6 +429,15 @@ Partial Class GrblGui
btnFileStop.Enabled = True
btnFileReload.Enabled = False

Case "Step"
gcode.sendGCodeFileStep()
btnFileSend.Tag = "Resume"
btnFileSend.Enabled = True
btnFileSelect.Enabled = False
btnFilePause.Enabled = True
btnFileStop.Enabled = True
btnFileReload.Enabled = False

Case "Pause"
gcode.sendGCodeFilePause()

Expand Down
2 changes: 2 additions & 0 deletions Grbl-Panel/GrblGui.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Public Class GrblGui
Public settings As GrblSettings ' To handle Settings related ops
Public ovrrides As GrblOverrides ' to display overrides
Public pins As GrblPins ' to display Pin states
Public info As GrblInfo ' to display Grbl information

Private _exitClicked As Boolean = False ' to separate Close (x) from File/Exit

Expand Down Expand Up @@ -66,6 +67,7 @@ Public Class GrblGui
state = New GrblState(Me)
ovrrides = New GrblOverrides(Me)
pins = New GrblPins(Me)
info = New GrblInfo(Me)

rescanPorts()
If My.Settings.Port <> "" Then
Expand Down
57 changes: 57 additions & 0 deletions Grbl-Panel/GrblInfo.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Partial Class GrblGui
''' <summary>
''' A Class to handle Grbl VER and OPT messages
''' </summary>
'''

Public Class GrblInfo
Private _gui As GrblGui

Public Sub New(ByRef gui As GrblGui)
' Get ref to parent object
_gui = gui
' For Connected events
AddHandler(GrblGui.Connected), AddressOf Me.GrblConnected

End Sub
''' <summary>
''' Activate Info object to request/process VER/OPT messages
''' </summary>
''' <param name="msg"></param>
Private Sub GrblConnected(ByVal msg As String) ' Handles GrblGui.Connected Event
If msg = "Connected" Then
_gui.grblPort.addRcvDelegate(AddressOf _gui.processVerOptMessages)
' We are connected to Grbl so populate the State
gcode.sendGCodeLine("$I")
once = True
End If
End Sub

Private _single As Boolean
Public Property once() As Boolean
Get
Return _single
End Get
Set(ByVal value As Boolean)
_single = value
End Set
End Property
End Class
''' <summary>
''' Handle incoming VER and OPT message from $I request
''' </summary>
''' <param name="data"></param>
Public Sub processVerOptMessages(ByVal data As String)
If info.once = True Then
If data.StartsWith("[VER:") Then
Dim str As String = data.Remove(data.Length - 3)
tbGrblVersion.Text = str.Remove(0, 5)
End If
If data.StartsWith("[OPT") Then
Dim str As String = data.Remove(data.Length - 3)
tbGrblOptions.Text = str.Remove(0, 5)
info.once = False
End If
End If
End Sub
End Class
4 changes: 2 additions & 2 deletions Grbl-Panel/GrblMacroButtons.vb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Partial Class GrblGui
If btnAdd.Text = Resources.GrblGui_dgMacros_DoubleClick_Update Then
For Each row As DataGridViewRow In dgMacros.Rows
If row.Cells(0).Value.ToString = tbName.Text Then
row.Cells(1).Value = tbGCode.Text
row.Cells(1).Value = tbGCode.Text.ToUpper()
bMatchFound = True
Exit For
End If
Expand All @@ -152,7 +152,7 @@ Partial Class GrblGui
dgMacros.Rows.Add(tbName.Text, tbGCode.Text)
End If
Else
dgMacros.Rows.Add(tbName.Text, tbGCode.Text)
dgMacros.Rows.Add(tbName.Text, tbGCode.Text.ToUpper)
End If
bDataChanged = True
btnAdd.Text = Resources.GrblGui_GrblMacroButtons_Load_Add
Expand Down
3 changes: 3 additions & 0 deletions Grbl-Panel/GrblOffsets.vb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ Partial Class GrblGui
End Select
gcode.sendGCodeLine("G10 L2 " + index + " " + axis + value)
End If
If tag.Contains("G43") Then
gcode.sendGCodeLine("G43.1" + axis + value)
End If

End Sub
''' <summary>
Expand Down
21 changes: 18 additions & 3 deletions Grbl-Panel/GrblOverrides.vb
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,41 @@ Partial Class grblgui
Case "Ov"
Dim ovr = Split(portion(1), ",")
tbFeedOvr.Text = ovr(0) + "%"
If ovr(0) = "100" Then
tbFeedOvr.BackColor = Color.White
Else
tbFeedOvr.BackColor = Color.Coral
End If
tbRapidOvr.Text = ovr(1) + "%"
If ovr(1) = "100" Then
tbRapidOvr.BackColor = Color.White
Else
tbRapidOvr.BackColor = Color.Coral
End If
tbSpindleOvr.Text = ovr(2) + "%"
If ovr(2) = "100" Then
tbSpindleOvr.BackColor = Color.White
Else
tbSpindleOvr.BackColor = Color.Coral
End If
If Not data.Contains("A") Then
btnSpindleOverride.BackColor = Color.Transparent
btnFloodOverride.BackColor = Color.Transparent
btnMistOverride.BackColor = Color.Transparent
End If
Case "A"
If portion(1).Contains("S") Then
btnSpindleOverride.BackColor = Color.Crimson
btnSpindleOverride.BackColor = Color.Coral
Else
btnSpindleOverride.BackColor = Color.Transparent
End If
If portion(1).Contains("F") Then
btnFloodOverride.BackColor = Color.Crimson
btnFloodOverride.BackColor = Color.Coral
Else
btnFloodOverride.BackColor = Color.Transparent
End If
If portion(1).Contains("M") Then
btnMistOverride.BackColor = Color.Crimson
btnMistOverride.BackColor = Color.Coral
Else
btnMistOverride.BackColor = Color.Transparent
End If
Expand Down
2 changes: 1 addition & 1 deletion Grbl-Panel/GrblState.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
If yes Then
_gui.gbState.Enabled = True
Else
_gui.gbStatus.Enabled = False
_gui.gbState.Enabled = False
End If
End Sub

Expand Down
Loading

0 comments on commit 41ab58c

Please sign in to comment.