Order of Gcode moves in startup being ignored

  • My startup files have the following sequence

    M140 S90 ;Start heating bed
    M190 S90 ;Wait for bed to reach temp before proceeding
    G21 ;metric values
    G90 ;absolute positioning
    G1 X0 Y0 Z15 F3000
    M564 S0
    M104 S240 ;Start heating extruder
    M109 S240 ;Wait for extruder to reach temp before proceeding

    Problem is it's heating the extruder THEN moving to X0 Y0 Z15

    Only started happening after updating to

    Firmware Name: RepRapFirmware for Duet 2 WiFi/Ethernet
    Firmware Electronics: Duet WiFi 1.02 or later
    Firmware Version: 2.02(RTOS) (2018-12-24b1)
    WiFi Server Version: 1.22
    Web Interface Version: 1.22.6

  • @pilotltd It's probably the M116 which, if you don't specify a heater number , will wait for all temperatures and other slow moving variables. Take it out - you don't need it if you use M190. Also, you don't need M140 neither do you need M104 followed by M109 - M109 on it's own will do the same thing (although you should really use G10 followed by M116 Hn but let's not complicate things too much).☺

  • Thanks Ian - I'll take the M104, M116 and M140 out and see what happens.

    G10 command? Has three different meanings on the Gcode wiki page.
    Retract, Set workplace coordinate, or Tool offset. I don't want to do any of those. Retract was done end of last job, workplace co-ord's in probing sequence at start of script, tool offset in config.g. Looks like a case of "make your minds up what it is reprap!" command 😂 Cura and Simplify3D only understand it as a retract command as do every other major flavour of gcode.


  • @pilotltd see


    this screen shot is from the Duet code wiki pages. note the R and S Params

  • @pilotltd Hi Steve,

    Yes I agree that G10 can be a little confusing which is why I said "let's not complicate things too much". I only mentioned it because the wiki for M109 says quote

    "This is deprecated because temperatures should be set using the G10 and T commands."

    However, most slicers don't understand that.

    The following might help with what you are trying to do. This is an extract from a macro that I use pre-print. Calling this macro is the only thing that I have in my slicer start gcode.

    M190 S40; start heating bed and wait for it to get to 40
    M140 S50; Now start to heat bed to 50 but don't wait
    G28 ; home all axes while completing bed heat
    T0 ; select a tool
    ; Set operating and standby temps
    G10 P0 S195 R195
    G10 P1 S195 R195
    G10 P2 S195 R195
    G10 P3 S195 R195
    G1 X80 Y363 F9000 ; move to rear
    M83; set extruder to relative
    M116 ; wait for all temps including hot end

    Hopefully that might explain things a bit better.

  • @deckingman It appears there's a bug or change in Simplify3d. If you state the bed temps it then follows it with two identical lines with -1 as the target temperature!! I think that's why the M116 was there to circumvent that behaviour. It puts M104 followed by M109 as defaults, maybe for compatability with Marlin as well. In the end this is the script that works without M140 or M190 defined at all. It puts the bed heater values in the correct place in the Gcode file just prior to the script entries.

    M106 S0
    G21 ;metric values
    G90 ;absolute positioning
    G1 X0 Y0 Z15 F3000
    M564 S0
    M104 S[extruder0_temperature] ;Start heating extruder
    M109 S[extruder0_temperature] ;Wait for extruder to reach temp before proceeding

  • @pilotltd Ahh. You made no mention that you were using S3D to generate your start gcode.

    Personally I've given up with using slicer generated start and end gcodes because they tend to use often deprecated or non-compatible commands or just mess with parameters that they shouldn't. As I said above, I set all temperatures in the slicer to zero then just have one line in my start gcode which calls a macro that does what I want, in the the way that I want it done.

Log in to reply