Great job on the post processor. Amazing! However, after a few hours of experimenting with a laser (which happens to be the latest toy, so I’m using it, unfortunately only 3 watts), and I’ve come across a possible issue.
Please read all the way through, I think I came up with a, at least, temporary solution, but let me continue.
My laser uses PWM to control the laser power, not voltage, as from D9. I’ve got it hooked up to Pin 4 and am using an M42 command to turn the laser on and off.
I’ve added the correct commands to the configuration locations in the MPCNC post processor. and it seems to work somewhat. The issue is that M42 is an immediate command.
Let me clarify with an example:
I’m cutting a small circle in paper, and the gcode starts like this:
;T0 D=0 CR=0 - ZMIN=0 - laser cutter
;Units in mm
G92 X0 Y0 Z0
M84 S1800 ;Change Stepper disable timeout to 30 minutes
G1 Z0 F1000
G1 X-4.851 Y9.12 F2000 <<<<<<< Move to circle start <<<<<<<<<<
M42 P4 S220 <<<<<<<<<< Turn on laser <<<<<<<<<<<<<<<<<<<
G1 X-4.859 Y9.41 F700 <<<<<<< Begin cutting circle <<<<<<<<<<<<<
My issue is that since the M42 command is immediate, it executes before completion of the G1 command in the buffer moving to the start of the circle. so the circles look sort of line “Q’s” with the laser turning on during the initial move command.
I solved the problem by entering “G4 S0 :M42 P4 S220” in the spot to turn the
laser on (and similar for turning the laser off). This solves the problem because the G4 S0 commands waits until the buffer is empty.
Here’s the issue: I’m not sure the colon “:” is an official command delimiter. It works, but from what I’ve read so far on the web, it’s an artifact, and I’m unsure if it will continue to work in the future. So, here’s the request, what would be much better would be if I could enter multiple lines of commands for laser on/off in the MPCNC post processor. If you take a look at ESTLCAM, there’s a multiline text field where multiple lines of code can be entered.
Would it be difficult to make the MPCNC post processor allow for this?
And for the bonus round, could there be a similar thing adding for “Tool Change”, “Program Start”, and “Program End” as ESTLCAM has?
Thanks! Sorry about the long post! And maybe I’m just totally confused - it happens y’know.