Running macros in response to conditions?
-
Thanks, David, that would be great as I can imagine quite a few uses for this approach.
Richard
-
In the mean time, I have configured this to prompt me with a blocking message box as below. Posting this in the hope it will help others.
In my config.g I have the following statement as the last line. This waits for response from me on the PanelDue and the DWC:
[[language]] M291 P"Please run Delta Start macro to set correct Smart Effector and do delta configuration" R"Startup tasks" S1 T30
I have a macro that this prompts me to run:
[[language]] ; Delta_Start.g M400 ; wait for all moves to stop ; first set Volcano settings again (safer option) M665 R228 L440.375 B185 H410 ; (Volcano) set delta radius, diagonal rod length, printable radius and homed height ; Check for Smart Effector installed M582 T2 ; if the jumper is on the layer fan connector on the Smart Effector then this will run sys/trigger2.g that contains the M665 setup for the e3D v6\. If not, the Volcano settings above will be used. M400 ; wait for all moves to stop G32 ; do delta configuration
and then trigger2.g:
[[language]] ; trigger2.g M400 ; Wait for all moves to stop M291 P"v6 Smart Effector detected" R"Auto detect Smart Effector" S1 T10 M400 ; Wait for all moves to stop M665 R228 L440.375 B185 H420 ; (e3dv6) set delta radius, diagonal rod length, printable radius and homed height
This makes it very difficult for me to forget to run the delta configuration but auto-detects which Smart Effector I have installed and ensures that the delta configuration is run.
Richard
-
I have just checked the code and I can't see why M582 would not work from config.g. Are you certain that it doesn't?
-
Hi David. It does work, but after everything else has finished working - almost as if it is at a lower priority or something.
This is what I saw yesterday: "I'm setting the M665 for the taller Volcano in the config.g, and calling "M581 T2 E0 C0 S0" right near the beginning. A bit further down the config.g I run M582 T2, which, when triggered, should call trigger2.g. At the end of config.g I run a G28 and a G32 and these always run before the commands in trigger2.g
It appears that the trigger check waits until all other commands in config.g have run and then runs at the same time as
the WiFi initiates. The M291 in the trigger2.g file runs after the M291 in the config.g so this would tend to support the order I see."Is it perhaps that it calls trigger2.g but first completes running the commands in config.g?
Richard
-
Yes, it will wait until config.g has finished processing before the trigger function is called.
I do not advise putting G32, G29 without parameters, or any other commands that perform movement in config.g. Use those commands either in a macro that you run before printing, or in your slicer start script. Also it's generally better to heat up at least the bed before running those commands.
-
Thanks, David. In the arrangement I have now, the only movement command in config.g is G28. The others are all in the macros.
Understood on heating the bed first - I generally do G32 again after getting the bed and nozzle to temperature. The first G32 is only intended to make sure I at least do one before printing even if it is approximate - without it I used to forget and ended up carving notches in the print surface!
Richard
-
If you really want to run your trigger followed by G28 you could set up trigger 3 to do the G28, using a spare endstop input that is always high (e.g. on the expansion connector or on CONN_LCD). The triggers will be run in trigger number order.
As you only want to run each trigger macro once, for safety I suggest you end each macro with a M581 command to disable the trigger.
-
I'm missing something, David, I'm sorry but I don't understand.
At the moment I only run a blocking message and a G28 (last line) in the config.g. This is on a large delta and it homes to max Z. Do you recommend not putting the G28 in the config.g?
The hold message reminds me to run the delta_start macro that will call the trigger function. After reading your note above I will move the M581 command from the config.g to this macro so that it is only called when I run that macro. I will also use the S-1 notation to disable it afterwards.
Thanks for your help.
Richard
-
I was suggesting a way in which you can make your macro run automatically and defer the G28 until after the macro has run.
-
Oh, OK, thanks for clarifying.
I'm very happy with where this ended up - when the printer starts up it displays a message telling me to run the Delta_Start macro.
This sets the trigger (M581), checks which Smart Effector is installed, then homes the printer, runs delta config and then disables the trigger condition.
It works great and I won't get caught out with the Volcano installed and think I have the shorter v6!
Thanks for your help.
Richard