Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions OpenbuildsGRBL.cps
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ properties =
spindleTwoDirections : false, // true : spindle can rotate clockwise and counterclockwise, will send M3 and M4. false : spindle can only go clockwise, will only send M3
hasCoolant : false, // true : machine uses the coolant output, M8 M9 will be sent. false : coolant output not connected, so no M8 M9 will be sent
hasSpeedDial : true, // true : the spindle is of type Makita RT0700, Dewalt 611 with a Dial to set speeds 1-6. false : other spindle
shouldHomeZ : true, // true : the machine should go to a specific z coordinate at start and end of gcode
shouldHomeXY : true, // true : the machine should go to a specific xy coordinate at end of gcode
machineHomeZ : -10, // absolute machine coordinates where the machine will move to at the end of the job - first retracting Z, then moving home X Y
machineHomeX : -10,
machineHomeY : -10
Expand All @@ -60,6 +62,8 @@ propertyDefinitions =
spindleTwoDirections: {title: "Bidirectional Spindle", description: "True if the spindle can rotate clockwise and counterclockwise, will send M3 and M4. False if the spindle can only go clockwise, will only send M3.", type: "boolean"},
hasCoolant: {title: "Has Coolant", description: "True if the machine uses the coolant output (M8 M9 will be sent). False if the coolant output not connected.", type: "boolean"},
hasSpeedDial: {title: "Has Speed Dial", description: "True if the spindle is of type Makita RT0700, Dewalt 611 with a Dial to set speeds 1-6.", type: "boolean"},
shouldHomeZ: {title: "Use Z Home Position", description: "True if the machine should go to a specific z coordinate at start and end of gcode.", type: "boolean"},
shouldHomeXY: {title: "Use XY Home Position", description: "True if the machine should go to a specific xy coordinate at end of gcode.", type: "boolean"},
machineHomeZ: {title: "Z Home Position", description: "Absolute machine coordinates where the machine will move to at the end of the job - first retracting Z, then moving home X Y", type: "number"},
machineHomeX: {title: "X Home Position", description: "Absolute machine coordinates where the machine will move to at the end of the job - first retracting Z, then moving home X Y", type: "number"},
machineHomeY: {title: "Y Home Position", description: "Absolute machine coordinates where the machine will move to at the end of the job - first retracting Z, then moving home X Y", type: "number"},
Expand Down Expand Up @@ -299,7 +303,7 @@ function onSection()
if(isFirstSection())
{
writeBlock(gAbsIncModal.format(90)); // Set to absolute coordinates
if (isMilling())
if (isMilling() && properties.shouldHomeZ)
{
writeBlock(gFormat.format(53), gMotionModal.format(0), "Z" + xyzFormat.format(properties.machineHomeZ)); // Retract spindle to Machine Z Home
}
Expand Down Expand Up @@ -458,7 +462,7 @@ function onSectionEnd()
function onClose()
{
writeBlock(gAbsIncModal.format(90)); // Set to absolute coordinates for the following moves
if (isMilling()) // For CNC we move the Z-axis up, for lasercutter it's not needed
if (isMilling() && properties.shouldHomeZ) // For CNC we move the Z-axis up, for lasercutter it's not needed
{
writeBlock(gAbsIncModal.format(90), gFormat.format(53), gMotionModal.format(0), "Z" + xyzFormat.format(properties.machineHomeZ)); // Retract spindle to Machine Z Home
}
Expand All @@ -468,8 +472,10 @@ function onClose()
writeBlock(mFormat.format(9)); // Stop Coolant
}
onDwell(properties.spindleOnOffDelay); // Wait for spindle to stop
writeBlock(gAbsIncModal.format(90), gFormat.format(53), gMotionModal.format(0), "X" + xyzFormat.format(properties.machineHomeX), "Y" + xyzFormat.format(properties.machineHomeY)); // Return to home position

if (properties.shouldHomeXY)
{
writeBlock(gAbsIncModal.format(90), gFormat.format(53), gMotionModal.format(0), "X" + xyzFormat.format(properties.machineHomeX), "Y" + xyzFormat.format(properties.machineHomeY)); // Return to home position
}
writeBlock(mFormat.format(30)); // Program End
writeln("%"); // EndOfFile marker - GRBL doesn't use it / ignores it, but it's so much tradition, so I left it in..
}
Expand Down