Skip to content

Commit

Permalink
Issue 5, Exception if Status Mask <> 15
Browse files Browse the repository at this point in the history
Issue 9, Exception if empty gcode line
Issue 10, Set jogging rate and increment on load
  • Loading branch information
gerritv committed Oct 27, 2014
1 parent 4aac6cc commit 406345d
Show file tree
Hide file tree
Showing 10 changed files with 341 additions and 303 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ V0.1.0.6 - 2014 Oct 6
- Fix save of Jog feed increment and rate settings
- Add param to set last/highest Grbl param to retrieve
- Block edit of Grbl Settings ID and description columns
V1.0.1.0 - 2014 Oct 13
- Issue 10 Add defaults and settings save for Jog feed Increment and Distance radio buttons
- Remove message box warnings about empty Feed rate and distance settings
- Protect from Status Report Mask <> 15 (Issue 5)
- Handle empty gcode lines (Issue 9)
6 changes: 6 additions & 0 deletions Grbl-Panel/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
<setting name="GrblLastParamID" serializeAs="String">
<value>$132</value>
</setting>
<setting name="JoggingFIDefault" serializeAs="String">
<value>I2</value>
</setting>
<setting name="JoggingFRDefault" serializeAs="String">
<value>F2</value>
</setting>
</GrblPanel.My.MySettings>
</userSettings>
</configuration>
5 changes: 5 additions & 0 deletions Grbl-Panel/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ V0.1.0.6 - 2014 Oct 6
- Fix save of Jog feed increment and rate settings
- Add param to set last/highest Grbl param to retrieve
- Block edit of Grbl Settings ID and description columns
V1.0.1.0 - 2014 Oct 13
- Issue 10 Add defaults and settings save for Jog feed Increment and Distance radio buttons
- Remove message box warnings about empty Feed rate and distance settings
- Protect from Status Report Mask <> 15 (Issue 5)
- Handle empty gcode lines (Issue 9)
2 changes: 1 addition & 1 deletion Grbl-Panel/GrblGcode.vb
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ Partial Class GrblGui
Dim line As String
' Read another line
line = gcode.readGcode()
state.ProcessGCode(line)
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
state.ProcessGCode(line)
' Set Message if it starts with (
If line.StartsWith("(") Then
Dim templine As String = line
Expand Down
6 changes: 0 additions & 6 deletions Grbl-Panel/GrblGui.vb
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,4 @@ Public Class GrblGui
' Raised when we succesfully connected to Grbl
Public Event Connected(ByVal msg As String)

Private Sub Button1_Click(sender As Object, e As EventArgs)
Dim i As Integer = settings.IsHomingEnabled()
i = i

End Sub

End Class
34 changes: 24 additions & 10 deletions Grbl-Panel/GrblJogging.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ Partial Class GrblGui
_gui.btnYMinus.Interval = 1000 / .JoggingYRepeat
_gui.btnZPlus.Interval = 1000 / .JoggingZRepeat
_gui.btnZMinus.Interval = 1000 / .JoggingZRepeat

' Set the default feed rate and increment
For Each rb As RadioButton In _gui.gbDistance.Controls
If rb.Tag = My.Settings.JoggingFIDefault Then
rb.Checked = True
End If
Next
For Each rb As RadioButton In _gui.gbFeedRate.Controls
If rb.Tag = My.Settings.JoggingFRDefault Then
rb.Checked = True
End If
Next
End With

End Sub
Expand All @@ -50,10 +62,6 @@ Partial Class GrblGui
Private Sub btnJogArray_Click(sender As Object, e As EventArgs) Handles btnXPlus.Click, btnXMinus.Click, btnYPlus.Click, btnYMinus.Click, _
btnZPlus.Click, btnZMinus.Click
Dim btn As RepeatButton.RepeatButton = sender
If whichDistance() = "" Or whichFeedRate() = "" Then
MessageBox.Show("Please set Distance and Feed Rate first", "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
Return
End If
Select Case btn.Tag
Case "X+"
gcode.sendGCodeLine(createJogCommand("X"))
Expand All @@ -77,12 +85,6 @@ Partial Class GrblGui


If cbSettingsKeyboardJogging.Checked Then
If whichDistance() = "" Or whichFeedRate() = "" Then
' We have no parameters, give message
MessageBox.Show("Please set Distance and Feed Rate first")
Return
End If

Select Case e.KeyCode
Case Keys.Left
gcode.sendGCodeLine(createJogCommand("X-"))
Expand Down Expand Up @@ -195,5 +197,17 @@ Partial Class GrblGui
End If
End Function

Private Sub rbDistancex_CheckedChanged(sender As Object, e As EventArgs) Handles rbDistance1.CheckedChanged, rbDistance2.CheckedChanged, rbDistance3.CheckedChanged, _
rbDistance4.CheckedChanged, rbFeedRate1.CheckedChanged, rbFeedRate2.CheckedChanged, _
rbFeedRate3.CheckedChanged, rbFeedRate4.CheckedChanged
' Remember the setting
Dim rbtn As RadioButton = sender
Select Case rbtn.Tag
Case "I1", "I2", "I3", "I4"
My.Settings.JoggingFIDefault = rbtn.Tag
Case "F1", "F2", "F3", "F4"
My.Settings.JoggingFRDefault = rbtn.Tag
End Select
End Sub
End Class

3 changes: 3 additions & 0 deletions Grbl-Panel/GrblState.vb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
Dim gcodeIndex As Integer = 0 ' current entry being processed

Dim comment As Boolean = False
If line.Length = 0 Then ' Deal with blank lines
Return
End If
If ignore.Contains(line(0)) Or (Not allcodes.Contains(line(0))) Then
Return ' ignore lines with no gcode
End If
Expand Down
18 changes: 12 additions & 6 deletions Grbl-Panel/GrblStatus.vb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ Partial Class GrblGui
If Me.cbVerbose.Checked Then
' Show data in the Status screen (from our own thread)
Me.lbResponses.Items.Add(data)
Me.lbResponses.TopIndex = Me.lbResponses.Items.Count - 1
If Me.lbResponses.Items.Count > 1 Then ' handle case where user doesn't have
Me.lbResponses.TopIndex = Me.lbResponses.Items.Count - 1
End If
Else
' filter out <> , ok, $G, $$ response messages
If data.Length > 0 And Not (data.First() = "<") And Not (data.First = "o") And Not (data.First = "$") And _
Expand All @@ -150,10 +152,14 @@ Partial Class GrblGui
' Lets display the values
data = data.Remove(data.Length - 2, 2) ' Remove the "> " at end
Dim positions = Split(data, ":")
Dim buffer = Split(positions(3), ",")
Dim rx = Split(positions(4), ",")
prgbRxBuf.Value = rx(0)
prgBarQ.Value = buffer(0)
Try
Dim buffer = Split(positions(3), ",")
Dim rx = Split(positions(4), ",")
prgbRxBuf.Value = rx(0)
prgBarQ.Value = buffer(0)
Catch
' do nothing, should have Status Report mask = 15
End Try
End If

' Show status on the buttons
Expand Down Expand Up @@ -186,7 +192,7 @@ Partial Class GrblGui
' Major problem so cancel the file
' Let GrblGcode class handle the error
'gcode.sendGCodeFileStop()
End If
End If

' Display the Parser state if that is the message type
If data(0) = "[" And data.Contains("F") Then ' we have a Parser status message
Expand Down
Loading

0 comments on commit 406345d

Please sign in to comment.