External trigger during a macro
-
Hi everybody,
I'm using duet wifi 2 + RRF 2.05.
Also, using a cartesian printer with 2 z motors and a BLtouch. I'm trying to write a macro with a configurated external trigger that will pause the movement of the Z axis while homing (G28 Z) once the external trigger is touched. The external trigger should be located somewhere in the middle of the Z-axis.
Is it possible to write such a macro?I already tried adding the next line to the config.g:
M581 E3 S1 T2 C0
I connected the trigger as shown in the DuenWifi2 pinout
And made a simple file called "trigger2.g" with just one line:
M300 S2000 P200Nothing really happened while homing and triggering the trigger.
Please help me
Thank you! -
@saarneu I'm not really familiar with RRF2.
But what happens when you check the trigger in both states with:M582 T2
-
@cosmowave
Hi thanks for helping!
sadly:
-
@saarneu You have a typo!
M582 not M852 -
@cosmowave said in External trigger during a macro:
M582
Ohh my bad yeah sorry
Ok, so the M582 T2 command called "Trigger2.g" immidietly.
I tried also putting M25 in the same file but:
"M25: Cannot pause print, because no file is being printed!" probably because it is a macro and not a print file. -
@saarneu Oh yeah... M582 triggers the trigger... But now we know that the trigger itself works.
Is there an Object Model in RRF2? Or an other option to check the input (E3)? -
@cosmowave said in External trigger during a macro:
Is there an Object Model in RRF2?
No. That was the main part of RRF3.
@saarneu said in External trigger during a macro:
I'm trying to write a macro with a configurated external trigger that will pause the movement of the Z axis while homing (G28 Z) once the external trigger is touched. The external trigger should be located somewhere in the middle of the Z-axis.
I don't think this is going to work to interrupt the G30 move for the BLtouch. You'd need to use an emergency stop if you wanted it to halt.
What exactly are you trying to accomplish?
-
@phaedrux
Hi thanks for helping
Actually, I'm trying to write a macro for an automatic z offset calibration.
First I want the nozzle to touch the bed with, (G30 Z-1) the external trigger, and then I would the printer to touch the bed with the probe (also with G30 Z-1).
Thank you very much! -
Here's an example macro that helps to automate the probe trigger height measuring and saving.
M291 P"Grid bed compensation map and Z Probe trigger height will be cleared. Ok or Cancel?" R"WARNING" S3 ; User must click OK or cancel. M291 P"Heights will be found in gcode console if logging successful gcode is enabled" R"Did you remember to enabled gcode logging?" S3 ; Clear compensation map and Z probe trigger height ; G28 ; home all axis M561 ; Disable any current bed compensation G90 ; Absolute positioning T0 ; Activate first tool M98 P"ZSpeedsSlow.g" ; Set lower speeds for Z homing and lower Z motor current M913 Z50 ; Drop motor current to prevent damage in case of head crash ; Preheat to probing temps ; M291 P"Preheating to bed to 60 and nozzle to 210 for accurate probing" M104 S210 ; Set nozzle to 210 and release M190 S60 ; Set bed to 60 and wait M109 S210 ; Set nozzle to 210 and wait M98 P"0:/macros/musical tunes/GetAttention.g" ; 1 ; M291 P"Nozzle will now move to center of bed to reset Z0 and calibrate probe" S3 M98 P"0:/macros/Calibration/Bed Leveling/1_Center Nozzle on Bed" G90 G1 Z3 F400 M400 G92 Z4 ; Reset z to 8 to allow jogging up to touch bed to nozzle M291 P"Jog the Z Axis until the bed and nozzle are touching and click OK" R"Setting Z=0" Z1 S3 M400 G92 Z0 ; Set z = 0 G90 G1 Z3 F400 M104 S0 ; Turn off hotend heater as it's no longer needed M291 P"Probe will now move to center of bed and measure trigger height 10 times" R"ZProbe Trigger Height Calibration" T3 M400 M98 P"0:/macros/Calibration/Bed Leveling/1_Center Probe on Bed" G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-1 M400 G1 Z5 M400 G30 S-3 ; measure probe height and set it. M400 M500 P31 ; save trigger height to config-override.g G1 Z5 M98 P"0:/macros/musical tunes/GetAttention.g" ; Turn off heaters ; M104 S0 ; Set nozzle to 0 and release M140 S0 ; Set bed to 0 and release M98 P"ZSpeedsNormal.g" ; return to normal speeds M98 P"CurrentsNormal.g" M400 M291 P"Homing" G28 ; Home Z M84 ; turn off the motors M291 P"Probing complete. Turning off heaters and homing axis. Check log for trigger heights and enter into config.g" S2