Homing in tpre makes Tn fail silently and tpost is not executed
-
Hello,
I'm currently working on ironing out some minor inconviniences with my toolchanger and one thing I noticed is, that I can't pick tools starting with an unhomed printer.
My tpre macro homes the printer if needed and only then continues to let tpost pick the tool. However, for some reason, RRF stops executing the toolchange after tpre, tpost is never called and therefore my tool is not actually picked up.
Further investigation shows that as soon as G28 or homeall.g is executed inside the tpre macro, things end up not working.Here are the relevant scripts:
tpre0
; tpre0.g ; called before tool 0 is selected echo "tpre0 start" M98 P"/macros/Toolchanging/Advanced/HomeIfNotHomed" echo "tpre0 after homing" ;WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! ;if you are using non-standard length hotends ensure the bed is lowered enough BEFORE undocking the tool! G91 G1 Z10 F3000 G90 M400 echo "tpre0 end"
HomeIfNotHomed
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed || !move.axes[3].homed G28
homeall
; homeall.g ; called to home all axes M98 P"homey.g" ; Home Y first, so that a head that is currently in one of the tool docks home correctly M98 P"homex.g" ; Home X M98 P"homec.g" ; Home C (ToolHead) M98 P"homez.g" ; Home Z
homex
; homex.g ; called to home the X axis ; ; generated by RepRapFirmware Configuration Tool v2 on Thu Dec 13 2018 18:14:06 GMT+0100 (Central European Standard Time) G91 ; relative positioning G1 Z5 F1000 H2 ; lift Z relative to current position G1 H1 X400 F10000 ; move quickly to X axis endstop and stop there (first pass) G1 X-5 F10000 ; go back a few mm G1 H1 X400 F360 ; move slowly to X axis endstop once more (second pass) G90 ; absolute positioning
homey
; homey.g ; called to home the Y axis ; ; generated by RepRapFirmware Configuration Tool v2 on Thu Dec 13 2018 18:14:06 GMT+0100 (Central European Standard Time) G91 ; relative positioning G1 Z5 F1000 H2 ; lift Z relative to current position G1 H1 Y-400 F10000 ; move quickly to Y axis endstop and stop there (first pass) G1 Y5 F10000 ; go back a few mm G1 H1 Y-400 F360 ; move slowly to Y axis endstop once more (second pass) G90 ; absolute positioning
homez
; homez.g ; called to home the Z axis ; ; generated by RepRapFirmware Configuration Tool v2 on Thu Dec 13 2018 18:14:06 GMT+0100 (Central European Standard Time) if sensors.gpIn[0].value = 0 || sensors.gpIn[1].value = 0 ;|| sensors.gpIn[2].value = 0 || sensors.gpIn[3].value = 0 M291 S1 T5 P"Please return tool to dock before homing Z" R"Can't home Z" abort G90 ; absolute positioning G1 X0 Y0 F15000 ; go to first probe point G30 ; home Z by probing the bed G91 ; relative positioning G1 Z10 F1000
homec
; homec.g ; called to home the C axis (coupler) if sensors.gpIn[0].value = 0 || sensors.gpIn[1].value = 0 ;|| sensors.gpIn[2].value = 0 || sensors.gpIn[3].value = 0 M291 S1 T5 P"Please return tool to dock before homing coupler" R"Can't home coupler" abort G91 M400 M913 C60 ; C MOTOR TO 60% CURRENT G1 H2 C-300 F10000 G92 C0 G90 M400 M913 C100 ; C MOTORS TO 100% CURRENT M98 P"/macros/Toolchanging/Coupler - Unlock" ; open coupler
Coupler - Unlock
if !move.axes[3].homed ;abort if C is not homed abort M564 S0 G90 G1 C120 F50000 M564 S1
tpost (I'm leaving out the macros here, the executing doesn't even reach the echo at the beginning)
; tpost0.g ; called after tool 0 has been selected echo "tpost0 start" M703 ;restore filament settings M564 S0 ; allow movement outside the normal limits M98 P"/macros/Toolchanging/Coupler - Unlock" ; unlock Coupler M98 P"/macros/Toolchanging/Advanced/MoveToDock/T0" M98 P"/macros/Toolchanging/Coupler - Lock" ; close Coupler ;heatup M116 P0 M98 P"/macros/Toolchanging/Advanced/MoveToDock/MoveOut" M400 ;wait for toolchange moves to finish if sensors.gpIn[0].value = 1 echo "Tool 0 is not loaded correctly, aborting..." M98 P"/macros/Toolchanging/Advanced/HandleToolchangeFault" ;M208 Y66 ; set Y max for this tool M564 S1 ; apply the normal limits again M98 P"/macros/Toolchanging/Advanced/PrimeBrush" M106 R1 ; restore print cooling fan speed
config.g
; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v2.1.8 on Sun May 10 2020 15:03:19 GMT+0200 (Mitteleuropäische Sommerzeit) ; General preferences ;M929 S3 ;enable debug logging M575 P1 S1 B57600 ;Enable PanelDue Port G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"V-Core Pro" ; set printer name M669 K1 ; select CoreXY mode ; Network M552 S1 ; enable network ; Drives M569 P0 S0 ; physical drive 0 goes forwards X/Y M569 P1 S0 ; physical drive 1 goes forwards X/Y M569 P2 S0 ; physical drive 1 goes forwards Coupler M569 P3 S0 ; physical drive 2 goes forwards E1 M569 P4 S0 ; physical drive 2 goes forwards E2 M569 P7 S0 ; physical drive 3 goes forwards Z1 M569 P8 S0 ; physical drive 3 goes forwards Z2 M569 P9 S0 ; physical drive 3 goes forwards Z3 M584 X0 Y1 C2 Z7:8:9 E3:4 ; set drive mapping (motion system) M584 E3:4 ; set drive mapping (extruders) ; Axis Limits M208 X-146:159 Y-149:72 C0:250 Z0:290 ; set axis minima & maxima M671 X-161:4:189 Y-118:177:-118 S20 ; set Z leadscrew positions M92 X160.00 Y160.00 C200.00 Z800.00 ; set steps per mm M350 X16 Y16 C16 Z16 I1 ; configure microstepping with interpolation M566 X500 Y500 C2 Z50 ; set maximum instantaneous speed changes (mm/min) M203 X30000 Y30000 C10000 Z2000 ; set maximum speeds (mm/min) M201 X3000 Y3000 C500 Z300 ; set accelerations (mm/s^2) M906 X1800 Y1800 C500 I30 ; set motor currents (mA) and motor idle factor in per cent M906 Z1400 I100 ; set motor currents (mA) and motor idle factor in per cent M906 E1100:1100 I100 ; set motor currents (mA) and motor idle factor in per cent (Flex3Drive) M84 S30 ; Set idle timeout ;M204 P1500 T3000 ;M593 F40 ; cancel ringing ;=================== Flex3Drive ====================== M92 E8600:8600 ; set steps per mm M350 E8:8 I0 ; configure microstepping M566 E10:10 ; set maximum instantaneous speed changes (mm/min) M203 E4000:4000 ; set maximum speeds (mm/min) M201 E150:150 ; set accelerations (mm/s^2) ;==================================================== ; Endstops M574 X2 S1 P"xstop" ; configure active-high endstop for high end on X via pin xstop M574 Y1 S1 P"ystop" ; configure active-high endstop for high end on Y via pin ystop M574 Z0 ; No Z-Endstop (use as probe instead) M574 C1 S3 ; Stall detect coupler at low end of its range ; Z-Probe M558 P8 C"zstop" H3 F1000 T20000 ; set Z probe type to unfiltered switch and the dive height + speeds G31 X0 Y0 Z0 P200 ; set Z probe trigger value, offset and trigger height M557 X-146:150 Y-149:72 P10 ; define mesh grid ;Stall Detection M915 C S6 F0 H200 R0 ; Coupler ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B3950 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M143 H0 S121 ; set temperature limit for heater 0 to 121C M307 H0 A305.7 C444 D2.9 V24.2 B0 ; Bed PID Tuning M140 H0 ; map heated bed to heater 0 M308 S1 P"e0_temp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M143 H1 S301 ; set temperature limit for heater 1 to 301C M308 S2 P"e1_temp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 2 as thermistor on pin e1temp M950 H2 C"e1heat" T2 ; create nozzle heater output on e1heat and map it to sensor 2 M143 H2 S301 ; set temperature limit for heater 2 to 301C M302 S190 R190 ;Cold extrusion settings M307 H1 R3.975 C149.3 D1.95 S1.00 V24.0 ; PID Tuning T0 M307 H2 R4.011 C141.6 D1.77 S1.00 V24.0 ; PID Tuning T1 M376 H20 ; Set bed correction taper ; Fans M950 F0 C"duex.fan3" ; Hotend Fan Tool 1 M106 P0 S255 L255 H1 T50 ; Hotend Fan Tool 1 M950 F1 C"duex.fan4" Q50 ; Layer Fan Tool 1 M106 P1 S0 H-1 ; Layer Fan Tool 1 M950 F2 C"duex.fan5" ; Hotend Fan Tool 2 M106 P2 S255 L255 H2 T50 ; Hotend Fan Tool 2 M950 F3 C"duex.fan6" Q50 ; Layer Fan Tool 1 M106 P3 S0 H-1 ; Layer Fan Tool 1 ;Z-Offset: If nozzle is too close to bed _reduce_ offset (negative number becomes more negative) ; If nozzle is too far away, _increase_ offset (negative number becomes less negative) ; Tools M563 P0 D0 H1 F1 ; define tool 0 G10 P0 X-9 Y39 Z-4.17 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C M563 P1 D1 H2 F3 ; define tool 1 G10 P1 X-9.35 Y38.5 Z-4.24 ; set tool 1 axis offsets G10 P1 R0 S0 ; set initial tool 1 active and standby temperatures to 0C ;Dock present switches M950 J0 C"duex.e2stop" ; Tool 0 Dock switch M950 J1 C"duex.e3stop" ; Tool 1 Dock switch M950 P1 C"duex.e5heat" ;Light switch PWM ;M591 D0 P1 C"e0stop" S1 ;Filament Sensor E0 ;Pressure Advance ;M572 D0 S0.2 ; Miscellaneous M98 P"/macros/Misc/Lights/On"
The console output for this looks like:
29.3.2021, 14:04:26 tpre0 end 29.3.2021, 14:04:26 tpre0 after homing 29.3.2021, 14:04:14 T0 tpre0 start
So basically, if I try to home the printer inside the tpre macro, it fails silently and does not execute tpost. Any idea why? Is this expected? If so, how do I pick up a tool from unhomed state via DWC?
Thank you!
-
@diamondback yes, its expected (was changed a few versions back)
Home your machine and then initiate the tool change -
@jay_s_uk Ok, thanks, that's good to know. Do you have any details about the why?
@chrishamm @dc42 can we get DWC adjusted so that tool changes and filament change commands home the printer first then or something? Because in the current state they are useless in un-homed state due to the mentioned issue.
-
@diamondback this is the post you want to read I think
https://forum.duet3d.com/topic/15965/allow-tool-change-scripts-or-issue-warning-on-non-homed-device?_=1616996891285 -
@jay_s_uk Hm, thanks for the link, but I think that doesn't quite describe my problem.
I'm fine with the tool scripts running without being homed (in fact I need that), my problem is that when I then want to home within the toolscript, it fails silently and does not continue with the toolchange.
-
@dc42 any insight?
-
I'll keep asking about this as it seems like a non-desired behavior at best and bug at worst.
@dc42 ? -
@diamondback the assumption is that you home the printer before you do anything else that involves movement. But I've added this to my list of things to look at for the 3.4 release.
-
@dc42 Thank you. The assumption is alright, it's just very weird that it fails silently etc. I'm ok with having to manually home, but right now it fails while executing some things and not others etc, so it's a bit messy.
-
@dc42 Is this still on the list for things to look into? The behavior still exists as described on the latest 3.4b3.