In estlcam, you can edit the “program end” text, which defines what the machine does once the program has ended. This is where I use the command M107, which turns off the pin for my spindle relay. This happens after the last toolpath has been complete and by default Estlcam raises the Z axis and returns the X and Y axes back to the origin point… and then runs the “program end” script. My issue is that when the toolpaths are done, it returns to the origin and the the spindle turns off and the program ends. When the program ends, the motors disengage allowing the spindle to fall down slowly to the workpiece. With the spindle still spinning a bit after it is turned off, it cuts slightly into the workpiece.
My wish would be to move the M107 and put it between the raising of the Z axis and the return X0 and Y0. This way, the spindle will have time to stop turning as it travels back to O,O.
I don’t see what in your program is disengaging the steppers. My stepper remain engaged. You may just have a short stepper inactivity timeout , or there may be more code that is executed at the end of script that you did not post. If it a stepper timeout issue, you can set the timeout using an M18.
M18 S60
This will keep your steppers engaged for 60 seconds after they stop moving. You can put anywhere in your script including your program end text.
If there is more g-code being executed that explicitly turns steppers off, you can use an M0 to pause the script for a specific amount of time.
M0 S30 Pausing for 30 seconds
This would be inserted after your M107.
Edit: I just checked the firmware. In configuration_Adv.h in the V1 maintained firmware, there is this line:
#define DEFAULT_STEPPER_DEACTIVE_TIME 1200
I assume the units are seconds, so by default, the steppers should remain engaged for 20 minutes. If your firmware is based on a version of V1 maintained firmware, then your script is explicitly turning off your steppers.
I don’t know. According to the Marlin g-code reference, M30 deletes a SD file, but maybe without parameters it disengages the steppers. It would be very easy to test. If it is the command that is disengaging steppers you can either 1) remove it and let the inactivity timeout determine when the steppers are disengaged, or 2) you can use the M0 to pause before this command is executed.
I took a look at the Marlin source and did some internet searches on the M30 g-code. On other machines/firmwares, it is a program end command, but in Marlin it is clearly used to delete an SD file. Here is the code:
void GcodeSuite::M30() {
if (card.isMounted()) {
card.closefile();
card.removeFile(parser.string_arg);
}
}
Even if the M0 works, I suspect the steppers are being disengaged by an M18 being delivered to your machine somewhere else. Note that the program you use to deliver your g-code to the machine can also insert commands at the end that will not appear in your g-code file. For example there is a separate end text area in Repetier-Host.
But how are you sending your g-code to your machine? As I said, there is an end text section on Repetier-Host that can deliver “extra” commands that will not appear in your file. And if the issue is an inactivity timeout, that M18 command can be anywhere in the file, not just at the end. Or it is possible that the M30 is generating some kind of error that is causing things to shut down, though I would expect to see an error message.
This screenshot is from Repetier-Host. I generate the gcode from Estlcam, then load it into Repetier-Host. I hit “Print” to begin the program. Is there some setting in Repetier-Host that implements an M18 command when the program finishes without it actually existing in the gcode?
The screenshot i mention is from my previous reply
In Repetier-Host, go to Config/Printer Setting. Select the Scripts tab. Select “End Code” from the “Script:” dropdown. This code will be inserted after your g-code file is executed.
Either the M0 or the M18 inactivity timeout will solve your problem, but it would be good to know that is shutting down your steppers.
Yes, you can uncheck that box. Now that I think about it, this was the issue in another topic on the forum. Also you should remove the M30 from your EstlCAM end code.