Welcome! Log In Create A New Profile

Advanced

Using M25 (pause) from within a G code file

Posted by bartdietrich 
Using M25 (pause) from within a G code file
March 21, 2016 02:23PM
Hi all,

For the past couple of weeks I've been printing multiple copies of an object (got around 130 so far, another 100 or so to go) on the printer at work. The top few layers of the object are an inscription so I thought I'd make it a different colour from the main body. It's a single extruder printer, so I inserted a M25 command into the G code at the point where it starts printing the inscription. For the first 3 or so hours of the print, the printer does the main body of the object (8 copies) and then pauses, waiting for me to get back to it, change filaments, retract 10 mm (as in the resume.g file) and type M24 to resume the print with the new colour. It works like a charm.

I tried the same approach (different object) on the printer at home yesterday. This is a dual-extruder printer but it's currently got one PLA and one ABS nozzle installed and I couldn't be bothered to swap the PLA nozzle for a second ABS one (I like to use each nozzle for one type of plastic only). The print pauses as expected when it gets to the M25 command, but when I send M24, it executes the movement instructions contained in the resume.g file and then goes back to pause. It's as if M25 causes its own address inside the G-code file to be PUSHed onto the call stack rather than the address of the instruction that follows it.

Can anyone think of why this might be happening off the top of their head (and a way around it)? Both printers run DC42's 1.09k firmware (I know, I know, I'll get around to updating it at some point). The pause.g and resume.g macros on both printers are largely identical (different coordinates to get the head out of the way of the print). It's a bit of an enigma considering that both printers run the same firmware. Something in the printer's config.sys? Any ideas?

Cheers,
Bart

Edited 1 time(s). Last edit at 03/21/2016 02:23PM by bartdietrich.
Re: Using M25 (pause) from within a G code file
March 21, 2016 03:59PM
I'll go and screen a few related scenarios and report back with more data...
Re: Using M25 (pause) from within a G code file
March 21, 2016 06:34PM
If you want to command a pause from within the gcode file being printed, you should use M226 instead of M25.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Using M25 (pause) from within a G code file
March 21, 2016 07:14PM
Hi dc42,

Thanks for that, that sorted it!

I was in the process of running a series of test prints of a small test cube with varying ways of invoking pause (interface button/send M25/inserted into file), invoking resume (interface button/send M24), starting print (upload&print/select from list of SD files: this was because for a while now large files uploaded to the printer print ok but afterwards there's no trace of them on the SD card, but that's a different issue). You can imagine there were quite a few combinations of these variables. Luckily I just got to the part where I was (successfully) replicating the problem of the M25 inserted into the file when I received the notification of your reply. So the next test print was with M226 instead of M25 and resume worked as expected!

It's still interesting though that M25 seems to work on one of the printers but not the other...

Thanks,
Bart
Re: Using M25 (pause) from within a G code file
March 22, 2016 08:01AM
What is the reason for using "wait for pin state" (M226) instead of "Pause" (M25) to pause a print? The G-code Wiki indicates that M226 requires a "P" and "S" parameter to supply the pin number and pin state that should be waited for. Would it not be better to have a set of standardised codes that work the same (when implemented) for all machines?

Dave
Re: Using M25 (pause) from within a G code file
March 22, 2016 05:54PM
In RRF, M226 is Gcode initiated pause, see [reprap.org]. Unfortunately the Marlin devs seem to have ignored the gcode list on the wiki and done their own thing for a while, so some gcodes have different meanings depending on the firmware. (Anyone who knowns the full history of this, feel free to chip in.)



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Using M25 (pause) from within a G code file
March 24, 2016 09:26AM
OK, I understand. It is a real PITA when different developers use different standards, but it has happened to my developments as well. The common situation is that two developers (companies) decide to implement the same new feature, and as at the time there is no standard available they each have no choice but to make up their own method. Obviously the R&D from competing companies are not going to talk to each other about what they are currently developing.

Dave
Re: Using M25 (pause) from within a G code file
October 30, 2016 06:01PM
Hi dc42,

Quote
dc42
In RRF, M226 is Gcode initiated pause, see [reprap.org].

I'm using an Ormerod 1 with "latest" stock firmware (EOL) and tried M25 as well as M226 from within the printed file. It seems like M226 was never implemented:
GCodes.cpp line 2519 of stock firmware

The M25 command stops the printer but the pause.g macro was not executed. The hot nozzle stops touching the printed part.

Considering an update I compared it to your fork and found the same lines for M226:
GCodes.cpp line 3007 of dc42 fork

The implementation of M25 seems different and I will give it a try.

Michael

EDIT typo

Edited 1 time(s). Last edit at 10/30/2016 06:02PM by lastNick.
Re: Using M25 (pause) from within a G code file
October 31, 2016 04:58AM
M226 is implemented. Take another look at the code and you will see that M226 falls through to M25 after waiting for all moves to complete.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login