SOLVED Tweaking slicer end gcode



  • Hi guys,

    I'm trying to iron out some issues from my end gcode in Cura. I run RRF 2.05.1 and I do have the gcode flavour set to RRF.

    At the end of a print I want to retract, move Z up 5mm from the relative position, move X and Y to min and Z to max, turn the extruder to 0C (so I don't cook the filament in the nozzle even if I'm not there immediately), and get a message that asks me if I want to cool down the printer. If yes, I want to turn the part-cooling fan on so the hotend can cool down faster, and if no, (for example if I'm going to start another print job and there is no point in cooling the hotend down) I want nothing to happen.

    The current gcode is as follows:

    G1 E-2 F1800; retract
    G91; relative positioning
    G1 Z5 F1800 ; lift Z relative to current position
    G90; absolute positioning
    G1 X5 F6000; move to X min
    G1 Y5 F6000; move to Y min
    G1 Z150 F1800; move to Z max
    G10 R0 S0; turn extruder heater off
    M291 P"Do you want to cool down the printer?" S3
    G10 R50 S50; set extruder temp to 50C
    M106 S255; turn part-cooling fan on
    M116; wait
    G10 R0 S0; turn extruder heater off
    M106 S0; turn part-cooling fan off
    

    The first issue is that I dont get the "OK" and "Cancel" options on the pop-up message to cool down the printer as M291 S3 would suggest.
    Pic:1.png

    The second issue is that when I do decide to cool down the printer, the hotend goes down to about 51-52C and heats up to about 53-54C and starts to bounce up and down at about that temp for about 5 min. I have an original E3D v6, that has been PID tuned at 220C in addition to using the correct E3D settings in config.g
    Pic: 2.png

    Thanks to all who try and help!
    Best!


  • Moderator

    What version of DWC are you using with 2.05.1? A non-matched version may explain the odd behaviour of the ok/cancel box.

    I do something similar, but I don't bother with the pop-up dialogue at all. I have to wait for the bed to cool anyway to get the part off so rapid turn around isn't really possible.

    ; stop.g
    ; called when M0 (Stop) is run (e.g. when a print from SD card is cancelled)
    ; Also called by slicer end gcode by M0
    ;
    M400			; Finish move queue
    M104 S0 		; Extruder heater off
    M140 S0 		; Bed heater off
    M106 S255 		; Fan at 100 to cool nozzle and bed
    G91			; Relative positioning
    M220 S100		; Set speed factor back to 100% in case it was changed
    M221 S100		; Set extrusion factor back to 100% in case it was changed
    G1 E-2 F9000			; Retract filament 2mm
    G1 X5 Y5 F9000		; Wipe nozzle 
    G1 Z20 F500			; raise nozzle 5mm from printed part
    G90				; absolute positioning
    G1 X150 Y130 F6000		; Move x and Y axis over to bed center so probe is on top of bed
    M109 S55		; Set hot end low and wait
    M116			; wait for temp to drop
    G4 S60			; Wait 1 minute
    M104 S0
    M107 ; stop fan
    G28 X Y			; Home X and Y
    M290 R0 S0		; clear babystepping
    M84			; Steppers off
    M98 P"ZSpeedsNormal.g"	; Load normal z speed settings again.
    
    
    ;Play a little beep beep beep to show print ended.
    M400			; Clear queue again before jingle
    G4 S1
    M300 P250 S750
    G4 P251
    M300 P200 S1250
    G4 P201
    M300 P250 S750
    G4 P251
    M300 P200 S1250
    G4 P201
    M300 P250 S2500
    G4 P251
    M300 P150 S2000
    G4 P151
    M300 P150 S2500
    G4 P151
    M300 P350 S3700
    G4 P351
    


  • I run DWC 3.1.1. which appears to be the latest stable release. Also, thanks for pasting your end gcode!


  • Moderator

    @equanimity8 said in Tweaking slicer end gcode:

    I run DWC 3.1.1. which appears to be the latest stable release.

    Yes, but you're also running 2.05.1 still. I would recommend using the DWC version from that release. 2.0.7 I believe.



  • Sorry it took me a bit to get back to this.

    I reverted to an earlier version of DWC and now the message displays properly. Thanks!

    Any ideas about the temp fluctuation?


  • Moderator

    @equanimity8 said in Tweaking slicer end gcode:

    The second issue is that when I do decide to cool down the printer, the hotend goes down to about 51-52C and heats up to about 53-54C and starts to bounce up and down at about that temp for about 5 min. I have an original E3D v6, that has been PID tuned at 220C in addition to using the correct E3D settings in config.g

    @equanimity8 said in Tweaking slicer end gcode:

    G10 R50 S50; set extruder temp to 50C

    @equanimity8 said in Tweaking slicer end gcode:

    Any ideas about the temp fluctuation?

    Well you've set the temp to 50, but the PID tune is for 220, so it's not going to be able to keep it very stable. I would suggest just using a timer instead of waiting for a low temp to be reached. Just time it yourself once to see how long it takes to cool down and use that in a G4 wait command.



  • Thanks for mentioning G4 I will go in that direction.

    @Phaedrux said in Tweaking slicer end gcode:

    Well you've set the temp to 50, but the PID tune is for 220, so it's not going to be able to keep it very stable.

    I agree that if I set a temp of 50C and I have an existing PID tuning for 220C there would be some fluctuations but since I'm trying to get down to 50C it shouldn't try to increase the temp, to the best of my understanding, just keep the heater off. Also, if it's trying to maintain 50C why does it do it for a certain amount of time and then complete the rest of the gcode instead of just trying to maintain 50C and getting stuck there?


  • Moderator

    @equanimity8 said in Tweaking slicer end gcode:

    Also, if it's trying to maintain 50C why does it do it for a certain amount of time and then complete the rest of the gcode instead of just trying to maintain 50C and getting stuck there?

    Because that's not what your gcode asks it to do

    G10 R50 S50; set extruder temp to 50C
    M106 S255; turn part-cooling fan on
    M116; wait
    G10 R0 S0; turn extruder heater off
    

    You set the temp to 50, turn on the fan, and then tell it to wait until it's stabilized at 50. Then turn off the heaters entirely. Based on your graph, that's exactly what it's doing.

    If you wanted to continue to use this temp drop gcode you could modify the M116 S10 to include a looser temp tolerance so that it doesn't bound around 50c for as long before moving on.

    https://duet3d.dozuki.com/Wiki/Gcode#Section_M116_Wait



  • Thanks! Apparently, I wasn't understanding the code fully.

    Anyway, I have implemented both of your suggestions and both work. I will stick to the latter one as I find it to be more elegant.

    I'm pasting the resulting end gcode in the hopes that it will be useful to somebody:

    G1 E-2 F1800; retract
    G91; relative positioning
    G1 Z5 F1800 ; lift Z relative to current position
    G90; absolute positioning
    G1 X5 F6000; move to X min
    G1 Y5 F6000; move to Y min
    G1 Z150 F1800; move to Z max
    G10 R0 S0; turn extruder heater off
    M291 P"Do you want to cooldown the printer?" S3
    G10 R45 S45; set extruder temp to 50C
    M106 S255; turn part-cooling fan on
    M116 S5; wait
    G10 R0 S0; turn extruder heater off
    M106 S0; turn part-cooling fan off
    

    Thanks for your input!


Log in to reply