Pause (M25/M226) doesnt pause when I want it to do
-
Hello!
I have a problem within a tool change script. During the filament change, a sensor is queried as to whether the filament has really been inserted. If it isn't, I'd like the script to pause at that point and give me a chance to intervene manually. I also want to be able to enter G-codes manually. A dialog stops at the relevant point, but prevents the G code input. M25 or M226 only pause after the end of the script or only work if the tool change was triggered by a print job.
Suggestions?
Greetings from Germany
Markus -
-
@mmueller70
If you're willing to try RRF 3.5.0b1 then there is a fudge you could use.
Be warned things could get all sorts of ugly if you use the wrong command.
I've done some rudimentary tests and it seems to work during a print job.
There is a limit to the number of nested macros that can be called, so I'm not sure if that could cause any problems.
Try something like this in your tool change script.
It leverages the new functions of M291 allowing you to input a string (G Code).
This string would be used to create a macro which is run to execute the G Codewhile sensors.gpIn[6].value = 0 M291 S7 P"Enter command" R"Enter G Code" L2 echo >"0:/macros/testM291input.g" input M98 P"0:/macros/testM291input.g"
It would be much safer to check the input against a list of allowed (or banned) G Codes.
However as there aren't really any string comparison functions the best you could do is add a bunch of conditions such aswhile sensors.gpIn[6].value = 0 M291 S7 P"Enter command" R"Enter G Code" L2 if (input = "G28") || (input ="G32") || (input = "G29") echo "Banned code" continue echo >"0:/macros/testM291input.g" input M98 P"0:/macros/testM291input.g"
I hope at some time in the future the new arrays will allow us to check against their values. So if an array contains the search value it returns the index or -1 if it's not found
e.g.var myArray = {"G28","G32","G29",) if index(input,var.myArray) != -1 echo "Banned code"
EDIT:
Forgot to say this won't work on PanelDue yet as it hasn't been updated to support the new M291 functions. -
@OwenD
That would be a possibility but not a solution. And very awkward and without DWC.
The other possibility I see would be to move everything related to tool change scripts to PrusaSlicer's custom gcode. Then the M25 commands are at job file level and should work. But that's also very ugly.
What's wrong with being able to pause a macro in case of a problem? -
@mmueller70
What you are asking for would really require a new G-Code I believe.
M25/226 are there to pause a print job and run pause.g
You're asking to be able "pause" a macro.
I suggest you put a detailed proposal together and post it in the firmware Wishlist section.
You haven't really explained what you want to be able to do in this period?
What should happen if there is a print job running (or not)
If you think about the new features of M291 in 3.5.0, there is a lot you can do.
For example the first message box could be a list of options
e.g.
*extrude
*retract
*park
*GCode
*continue (do nothing)Based on the received input you can do many things.
What I posted is the only way I can see to run a specific G code. -
@OwenD
I use a Prusa MMU2s to change filaments.
Pretty reliable now too. But sometimes the new filament cannot be inserted correctly, e.g.- previously the cutting process got stuck and the position of the selector no longer fits
- the cut was unusable because threads formed during the extract or remained in the selector
- whatever
Then I would like to be able to eliminate the problem, insert the first cm manually and then let the tool change script continue.
Sometimes I have to re-home an axis or move it to a certain position, release the filament for manual movement and switch on the extruder feed again (this involves turning a roller in the MMU2, which presses the corresponding filament onto a gear). It's unpredictable.
And easier if the whole script doesn't just run to the end and I have to do a lot more by hand.Just hold, do pause.g, let me do it and move on.
Here are my scripts for tool selection, if someone likes to see it.
pre1.g
; called before tool 1 is selected M98 P"tool_pre_laden.g" U{global.u1} W{global.w1}
tool_pre_laden.g
; select Filament G90 ; absolute moves M98 P"homeu.g" ; for safety reasons M400 if sensors.gpIn[0].value = 1 G1 W{global.w5} ; release filament M291 P"Filament in selector, please clean" S2 ; blocking, but blocks DWC too M25 ; Pause (not the way I intend) G1 W{param.W} G1 U{param.U} F2000 ; move selector to Tool position echo >"uposition.g" "G92 U",param.U ; save selektor Position (to home at some restart, when filament is in it and moves are not possible) G1 W{param.W} F10000 ; move idler to Tool position
tpost1.g
; called after tool 1 has been selected M98 P"tool_post_laden.g" U{global.u1} W{global.w1}
t_post_laden.g
M302 P1 ; allow cold extrusion G90 ; absolute moves while sensors.gpIn[0].value = 0 ; feed max 100 mm, till sensor in selector G1 E1 F5000 if iterations > 100 ; error if no sensor signal G1 W{global.w5} F10000 ; release filament for manual feed M291 P"Filament load error detected. Filament is free for manual feeding" S2 ; blocking, but blocks DWC too M25 ; Pause (not like I wish to pause) G1 W{param.W} F10000 ; grab filament for automatic feed while sensors.gpIn[0].value=1 ; draw back manual feeded filament out of sensor G1 E-1 F500 G1 E1 F500 ; ...and forward - so we have are at the point we wanted to be without user interaction - go on break G1 E216 F3000 ; move filament in main extruder G1 W{global.w5} F10000 ; free filament in MMU2s - all work now by main extruder G1 E341 F5000 ; feed to hotend M116 P4 ; wait for temperature M302 P0 ; no cold extrusion G1 E13 F5000 ; fast feed into hotend G1 E10 F300 ; feed into hotend
-
@mmueller70
I see what you're trying to do.
I'll leave this to @dc42One other option is change your macro to..
- M25 ; pause the print
- M400 ; wait for any moves
- M116 ; wait for any temp changes in pause.g
- M99 ;exit the macro
- Do whatever
- Manually run the tool load macro again
- resume the print
-
@mmueller70 why do you need to enter GCodes manually? Would it suffice to be able to run a few fixed GCodes, for example to feed or retract filament?