Using Code Substitution to add a pause and raise the printhead
 
Notifications
Clear all

Using Code Substitution to add a pause and raise the printhead  

  RSS
Tango
(@tango)
Reputable Member
Using Code Substitution to add a pause and raise the printhead

I'm working on a project in PrusaSlicer to print a 5x5 grid of squares, across the print bed, to use for adjusting the Z-axis offset. It's a major help to have these squares printed in order, from left to right and front to back, so it's easy, when evaluating the print quality later, to follow the printing order. I'm using sequential printing to do that.

I've used the Code Substitution feature in PrusaSlicer so when an object is done, I can raise the printhead high enough that I can see the just printed square and have time to decide whether to raise or lower the head on the Z Axis for printing the next square. So I use:

G1 Z 75
G4 S5

That moves the head up and waits 5 seconds for me to look over what I have so I can decide how to adjust the Z offset.

I'd like to add a message on the LCD when this happens, since I have a few friends that want to use the same file for adjusting their printers. I tried using:

M0 Adjust Z Live Adjust now

When I do this, OctoPrint complains and says M0 is a blacklisted command.

I wanted to use M117 and tried that:

M117 Adjust Z offset now

I get, on the LCD, "M117 Adjust Z Offset now" and, after a few seconds, the "M117" disappears. I've also read people saying when they use M117 to display a message on the LCD screen, the message flashes up, but once the printer goes on to the next command, it goes away.

G4 works for pausing the printer, but it seems I can't use M0 or M1 to send a message and there are issues with M117. What is the best way, in GCode, to print a message on the LCD so it remains long enough to be useful and doesn't include the GCode command telling it to print?

Posted : 28/02/2024 9:36 am
FoxRun3D
(@foxrun3d)
Famed Member
RE: Using Code Substitution to add a pause and raise the printhead

Curious if anyone has a good answer because I've looked into this a long time ago and came up empty handed because M117 gets wiped out by the next command.

Formerly known on this forum as @fuchsr -- until all hell broke loose with the forum software...

Posted : 28/02/2024 12:58 pm
Neophyl
(@neophyl)
Illustrious Member
RE: Using Code Substitution to add a pause and raise the printhead

As far as I know this is all depending on how the printers firmware deals with the commands.  There's very little you can do slicer side.  

Posted : 28/02/2024 2:15 pm
Tango
(@tango)
Reputable Member
Topic starter answered:
RE: Using Code Substitution to add a pause and raise the printhead
Posted by: @fuchsr

Curious if anyone has a good answer because I've looked into this a long time ago and came up empty handed because M117 gets wiped out by the next command.

One thing I tried was using G4 S5 and it paused. Even after the pause, the bottom line of the LCD still said, "Sleeping..." I'm thinking maybe using that, followed by M117, "Printing next square," or something like that, to wipe out the "Sleeping..." message. The issue I have with the M117 command was how it came up with M117 showing first on the LCD, then the M117 disappeared, leaving only the message I used.

What I'd prefer would be a command that would pause for X seconds AND display a message. Then, if the message disappears after the pause, that's no problem.

As far as I know this is all depending on how the printers firmware deals with the commands.  There's very little you can do slicer side.  

The slicer side is easy. I'm using a regex and expanded GCode so I get more comments in it. I use the regex to search for "; stop printing object" and then I replace it with the commands I want. I have found some documentation on Prusa and GCode. I'd like to stick with codes that most printers will handle, though, so I can use it on my Ender 3 Pro and so friends (or people here) can use it for multiple printers.

Posted : 28/02/2024 7:40 pm
Neophyl
(@neophyl)
Illustrious Member
RE: Using Code Substitution to add a pause and raise the printhead

Tango my point was yes the slicer is easy, you can do whatever you want but if the printer firmware just doesn’t handle those commands how you want then you have almost no options. Except to customise the printer firmware, which is a little beyond most users. 

Posted : 28/02/2024 8:50 pm
Share: