Staring macro doesn't behave as expected
-
I noticed during commissioning a customers printer that my macro I created to purge the extruder will extrude the correct amount during the purge line.
It moves to the correct position and starts at X5 Y70 and travels to X5 Y220. Halfway through this move I see DWC will show 7.5 than at the end it will show 15
The hotend moves to X5.3 Y220 and moves to X5.3 Y70. Halfway through this move DWC shows the position at 22.5 and when the move finishes it shows 30.
However after the final move the extruder drive position jumps to 40.
I also noticed G92 E0 doesn't reset the extruder position like it does for XYZ
; Purge nozzle called at in the starting script of the slicer profile M98 P"/macros/Purge" M291 P"purge started !" R"purging.." S1 T2 ; display msg G1 Z10 F3000 ; move z up little to prevent scratching of surface G1 X5 Y70 Z0.3 F5000.0 ; move to start-line position G1 Z0.3 F1000 ; print height G1 X5 Y220 F1500.0 E15 ; draw 1st line G1 X5.3 Y220 Z0.3 F5000.0 ; move to side a little G1 X5.3 Y70 Z0.3 F1500.0 E30 ; draw 2nd line G1 E-5 F3000 ; Retract 1mm filament G1 Z3 F3000 ; move z up little to prevent scratching of surface G1 X150 Y150 F6000 ; move to center of the bed M291 P"purge finished !" R"purging.." S1 T2 ; display msg
-
Do you have pressure advance enabled? Could try disabling it for the purge. See if that makes a difference?
Are you in relative or absolute extrusion?
@dhusolo said in Staring macro doesn't behave as expected:
I also noticed G92 E0 doesn't reset the extruder position like it does for XYZ
Check actual position with M114
-
@phaedrux Originally I did have it enabled however I made sure to disable it with
M572 D0 S0
just to confirm that wasn't the issue.M83 is in config.g but when I check the Gcode exported from S3D it has M82.
I'm doing a calibration cube at the moment so I can't do any testing but I did notice the drive position getting reset when I started the print. I do not have
relative extrusion enabled in S3D but I do have the checkbox for "Allow zeroing of extrusion distances (i.e. G92 E0)"M291 P"Homing all axis" R"Printing.." S1 T2 G32 ; Run mesh grid compenstion M98 P"/macros/Starting Script" ; run Purge macro M291 P"Printing started !" R"Printing.." S1 T3
-
@dhusolo Your macro looks to be a bit of a combination of relative and absolute extrusion moves. You need to decide if you want to use relative or absolute and it's generally a good idea to put either M83 or M82 at the start of the macro. That way, the moves within the macro will always be correct regardless of what the slicer might do or other external changes to the configuration might occur.
So your first move extrudes 15mm of filament. Assuming this is relative, it's fine as it is. But your second move would extrude 30mm of filament if you are using relative, yet the Y distance travel is the same as the first move. So if you intend to use relative extrusion, then you need to change the second "E" move to be 15 (the same as the first "E" value). Alternatively, if you decide to use absolute extrusion, then that second value is fine (because it will move the extruder from 15mm to 30 mm) but you need to zero the extruder at the start of the macro. If you don't do that the first move move will be to a position of 15mm from when the extruder was last zeroed. Then finally, you retract some filament with an E-5 move. This is compatible with relative extrusion as it will retract 5mm of filament but if you are using absolute extrusion (as indicated by the the E30 value for the second line), then it would retract filament all the way back to 5mm from the start position.
-
@deckingman Thank you very much sir. That was the answer I was looking for. I'll give it a shot later tonight.
-
@phaedrux The drive position in DWC shows 5146.3.
I don't know why there are 2 E0 in M114M114 X:174.500 Y:0.000 Z:46.040 E:0.000 E0:5146.3 Count 34900 34900 18395 Machine 174.500 0.000 46.040 Bed comp -0.053
Here is my config.g
; ================= General preferences =================== M80 ; Turns on the ATX power supply G90 ; send absolute coordinates... M669 K1 ; Select CoreXY mode ; ====================== Network =========================== M552 S1 ; enable network ; ======================= Drives =========================== M569 P0 S1 ; physical drive 0 goes forwards M569 P1 S1 ; physical drive 1 goes backwards M569 P2 S1 ; physical drive 2 goes backwards M569 P3 S1 ; physical drive 3 goes backwards M569 P4 S1 ; physical drive 3 goes backwards M584 X0 Y1 Z2:4 E3 ; set drive mapping Z3=Left, Z4=Right ; ===================== Drive Settings ===================== M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X200.00 Y200.00 Z400.00 E405.00 ; set steps per mm 100/102.5=.0975 * 415.15 M566 X700.00 Y700.00 Z24.00 E1000.00 ; set maximum instantaneous speed changes (mm/min) M203 X35000.00 Y35000.00 Z800.00 E4000.00 ; set maximum speeds (mm/min) M201 X6000.00 Y6000.00 Z100.00 E1500.00 ; set accelerations (mm/s^2) M906 X1600 Y1600 Z1600 E1000 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S120 ; Set idle timeout ; ================ Independent Z Leveleing ================= M671 X-75.5:354.5 Y143.2:143.2 S10 ; leadscrew pivot point: ; ===================== Axis Limits ======================== M208 X-35.5 Y0 Z0 S1 ; set axis min M208 X320 Y326.8 Z340 S0 ; set axis max ; ======================= Endstops ========================= M574 X1 S1 P"xstop" ; configure active-high endstop for low end on X via pin xstop M574 Y2 S1 P"ystop" ; configure active-high endstop for high end on Y via pin ystop M574 Z1 S2 ; configure Z-probe endstop for low end on Z ; ======================== Z-Probe ========================= M950 S0 C"exp.heater3" ; create servo pin 0 for BLTouch M558 P9 C"^zprobe.in" H5 F300 T9000 ; set Z probe type to bltouch and the dive height + speeds G31 P500 X-42.45 Y0 Z1.370 ; set Z probe trigger value, offset and trigger height ; ======================== Heaters ========================= M308 S0 P"bedtemp" Y"thermistor" A"Bed" T100000 B3950 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 Q10 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H0 B0 R0.450 C615.4 D2.65 S1.00 V24.1 ; Heatbed PID M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e0temp" Y"thermistor" A"Hotend" T100000 B4725 C0.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 M307 H1 B0 R2.461 C155.7 D10.12 S0.90 V24.1 ; Hotend PID .4mm M143 H1 S260 ; set temperature limit for heater 0 to 260C M308 S2 P"mcu-temp" Y"mcu-temp" A"Duet Board" ; Configure MCU sensor ; ========================= Fans =========================== M950 F0 C"fan2" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P0 C"Layer fan" S0 H-1 ; set fan 1 value. Thermostatic control is turned off M950 F1 C"fan1" Q500 ; create fan 2 on pin fan2 and set its frequency M106 P1 C"HE Fan" S1 H1 T40 ; set fan 2 value. Thermostatic control is turned off ; ======================== Tools =========================== M563 P0 D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; ===================== Custom settings ==================== M564 H0 ; Let the Jog buttons work blv: added to allow jog buttons ; ====================== Miscellaneous ===================== M575 P1 S1 B57600 ; enable support for PanelDue M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; set voltage thresholds and actions to run on power loss
-
@dhusolo There is only one "E0" in that M114. The first is simply "E". I don't know why that one us there - looks like a glitch in the reporting format possibly?
-
@dhusolo said in Staring macro doesn't behave as expected:
@deckingman Thank you very much sir. That was the answer I was looking for. I'll give it a shot later tonight.
No worries. Just remember that all moves are relative to something. With relative extrusion, the E value will be relative to the last move end position. With absolute extrusion, the E value is relative to when the extruder was last zeroed. If you think about it, when you want to extrude (say) 15 mm of filament, an absolute value would first have to be converted to a relative value which is why it's generally best to always use relative extrusion IMO).