I am using RRF 3.3 and the macro:

; Engage the toolchanger lock. RepRap Firmware V3.3RC3 version. G91 ; Set relative mode G1 U10 F5000 H0 ; Back off the limit switch with a small move G1 U200 F5000 H3 ; Perform up to one rotation looking for the torque limit switch Y0.5 ; H3 will modify axis limits they must be reset with M208 see below (use your axis limits) ;Pickup success detection | Aborts if no Tool picked up M400 ; Make sure moves are complete if {abs(move.axes[3].machinePosition) > 90 || abs(move.axes[3].machinePosition) < 20} ;if tool is not picked up | (Change 20 (half pickup) and 90 (no Pick up) to the value you need) echo move.axes[3].machinePosition ;debug output of the reached position M208 U0:201 ;restore axis limits (see above H3) set global.tool_change_Aborted = true ;send error condition M98 P"/macros/tool_change/tool_unlock.g" ; Unlock the tool G1 Y-20 ;back off M291 P"Werkzeug nicht richtig geladen. Ursache gefunden und behoben? Erneut versuchen!" R"Warnung Werkzeug nicht aufgenommen" S3 T-1 x1 Y1 U1 set global.tool_change_Aborted = false T{state.currentTool} if{job.duration != null} M25 ;pause job echo "Paused" else abort "Aborted" ;Behaviour after successful pick up echo "Picked up Tool",{state.currentTool} ;success message set global.tool_change_Aborted = false ;reset error condition M208 U0:201 ;restore axis limits (see above H3) G90 ; Set absolute mode

I will look into using M0 /M1 .