Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Setting Print and Bed temperatures in start code

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    5
    17
    3.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phaedruxundefined
      Phaedrux Moderator @KeithW
      last edited by

      @KeithW said in Setting Print and Bed temperatures in start code:

      M104 S230 T1
      M109 S230 T1

      Do you have two tools, or just one?

      @KeithW said in Setting Print and Bed temperatures in start code:

      I am not sure if Pnnn is refering to the heater number of the Tool number so I have tried both

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

      P refers to the tool.

      @KeithW said in Setting Print and Bed temperatures in start code:

      G10 P0 S{print_temperature}

      Are you sure {print_temperature} is the correct variable format for S3D?

      This is what I use in Slic3r.
      G10 P0 R100 S[first_layer_temperature] ; set temp and standby temp

      @KeithW said in Setting Print and Bed temperatures in start code:

      Simplify3D also adds its own start code in the form of:

      Are you able to modify that section to have a T0 at the start of it?
      Do you have a T0 at the end of your config.g?

      Z-Bot CoreXY Build | Thingiverse Profile

      KeithWundefined 1 Reply Last reply Reply Quote 0
      • KeithWundefined
        KeithW @Phaedrux
        last edited by

        @Phaedrux said in Setting Print and Bed temperatures in start code:

        Do you have two tools, or just one?

        Just the one.

        @Phaedrux said in Setting Print and Bed temperatures in start code:

        P refers to the tool.

        So P0 is correct as I only have 1 tool?

        @Phaedrux said in Setting Print and Bed temperatures in start code:

        Are you sure {print_temperature} is the correct variable format for S3D?

        No, I am sure of nothing but I think it used to work. I should RTM I guess.

        @Phaedrux said in Setting Print and Bed temperatures in start code:

        Are you able to modify that section to have a T0 at the start of it?

        In Simplify3D in the Temperature Tab you can select the Temperature Identifier but the BED is T0 and the extruder is T1 I think but then you also select the Temperature Contoller Type of Extruder or Heated Bed so maybe that identifies it and it should be T0 for both. I really don't know, I was hoping someone else did.

        @Phaedrux said in Setting Print and Bed temperatures in start code:

        Do you have a T0 at the end of your config.g?

        Yes, this is my config.g

        ; Configuration file for Duet 0.8.5 (firmware version 1.21)
        ; executed by the firmware on start-up
        ;
        ; generated by RepRapFirmware Configuration Tool v2.1.8 on Fri Feb 21 2020 19:36:19 GMT+0000 (Greenwich Mean Time)
        
        ; General preferences
        G21                                 		; Work in millimetres
        G90                                         ; send absolute coordinates...
        M83                                         ; ...but relative extruder moves
        M550 P"The BFK"                             ; set printer name
        M551 P"reprap"                        		; Machine password (used for FTP)
        M555 P2                             		; Set output to look like Marlin
        M665 R171 L360 B150 H468.5                  ; Set delta radius, diagonal rod length, printable radius and homed height
        M666 X0 Y0 Z0                               ; put your endstop adjustments here, or let auto calibration find them
        
        
        ; Network
        M540 PBE:EF:DE:AD:FE:EC                     ; set custom MAC address
        M552 P192.168.1.12 S1                       ; enable network and set IP address
        M553 P255.255.255.0                         ; set netmask
        M554 P192.168.1.1                           ; set gateway
        M586 P0 S1                                  ; enable HTTP
        M586 P1 S1                                  ; enable FTP
        M586 P2 S1                                  ; enable Telnet
        
        ; Drives
        M569 P0 S1                                  ; physical drive 0 goes forwards
        M569 P1 S1                                  ; physical drive 1 goes forwards
        M569 P2 S1                                  ; physical drive 2 goes forwards
        M569 P3 S1                                  ; physical drive 3 goes forwards
        M584 X0 Y1 Z2 E3                            ; set drive mapping
        M92 X160.00 Y160.00 Z160.00 E3800.00        ; set steps per mm
        M566 X1200.00 Y1200.00 Z1200.00 E0.1        ; set maximum instantaneous speed changes (mm/min)
        M203 X21000.00 Y21000.00 Z21000.00 E3600.00 ; set maximum speeds (mm/min)
        M201 X2000.00 Y2000.00 Z2000.00 E100.00     ; set accelerations (mm/s^2)
        M906 X1000 Y1000 Z1000 E800 I30             ; set motor currents (mA) and motor idle factor in per cent (Maybe Remove I30?)
        M84 S30                                     ; Set idle timeout (Maybe Remove This?)
        
        ; Axis Limits
        M208 Z-0.1 S1                               ; set minimum Z
        
        ; Endstops
        M574 X2 Y2 Z2 S1                            ; set active high endstops
        
        ; Z-Probe
        M558 P8 R0.4 H5 F1200 T3600                 ; set Z probe type to effector and the dive height + speeds
        G31 P100 X0 Y0 Z-0.1                        ; set Z probe trigger value, offset and trigger height
        M557 R150 S25                               ; define mesh grid
        
        ; Heaters
        M305 P0 T100000 B3950 R4700 H-20 L0   	    ; set thermistor + ADC parameters for heater 0
        M143 H0 S160                                ; set temperature limit for heater 0 to 160C
        M305 P1 X200                                ; configure PT100 for heater 1
        M143 H1 S285                                ; set temperature limit for heater 1 to 285C
        M570 H1 P10 T20 S180			    ; Hot end may be a little slow to heat up so allow it 180 seconds
        
        ; Fans
        M106 P0 S0 I0 F500 H-1                      ; set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
        M106 P1 S1 I0 F500 H-1                      ; set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned off
        
        ; Tools
        M563 P0 D0 H1 F0 S"Hot End"                 ; define tool 0 (Maybe Remove F0?)
        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 are not defined
        
        ; Miscellaneous
        ;M501                                       ; load saved parameters from non-volatile memory (I commented this out)
        T0                                          ; select first tool
        
        deckingmanundefined Phaedruxundefined 2 Replies Last reply Reply Quote 0
        • deckingmanundefined
          deckingman @KeithW
          last edited by

          @KeithW This may or may not help you but I've kind of given up on using the slicer to do anything other than generate the gcode for the print. That is to say, I no longer use the slicer to set tool or bed temperatures but simply have one line in the "custom gcode section" which calls one "pre print" macro and one "post print macro". I have a number of these macros which only differ in the actual temperature values. The main reason for doing this is that it gives me much better control over what happens and when. For example, the first thing the macro does is set the bed temperature to 40 deg C and wait (M190 S40). Once the bed reaches 40 deg C, it then sets the bed temperature to the required print temperature (usually either 50 or 60 deg C) but does not wait (M140 Snn). While this is happening , it runs my home all macro (G28) then heats the nozzle by using G10 S and R and selecting a tool. Finally it waits for all temperatures to reach their set values (M116). The net result is that the homing, hot end heating and everything else gets done in the time it takes to heat the bed. There is no extra wait for one thing to reach temperature which another is heating but at the same time, the hot end does not sit there at print temperature any longer than is necessary.

          The other thing about using macros in this way is that they are "slicer agnostic". That is to say, all you have to do is call the macro from whatever slicer you happen to choose. So you can swap between slicers without having to delve into their own methods of setting temperatures (other than disabling them - setting them to 0 works in Slic3R and it's variants). It also allows hot end active and standby temperatures to be set "correctly" using G10 S and R.

          I don't know if that helps, but if it does, I'd be happy to share my pre and post print macros.

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

          KeithWundefined 1 Reply Last reply Reply Quote 0
          • KeithWundefined
            KeithW @deckingman
            last edited by

            @deckingman

            So how do you deal with all the differing Print and bad temperatures? Do you specifically call the macro in the Slicer profile and have a different on in config.g for each scenario? I only ever use Simplify3D so I am not specifically bothered about it being slicer agnostic but if it is easier then I am all for it.

            I would like to at least try your solutions so if you would share the macros that would be good.

            deckingmanundefined 1 Reply Last reply Reply Quote 0
            • deckingmanundefined
              deckingman @KeithW
              last edited by deckingman

              @KeithW said in Setting Print and Bed temperatures in start code:

              @deckingman

              So how do you deal with all the differing Print and bad temperatures? Do you specifically call the macro in the Slicer profile and have a different on in config.g for each scenario? I only ever use Simplify3D so I am not specifically bothered about it being slicer agnostic but if it is easier then I am all for it.

              I would like to at least try your solutions so if you would share the macros that would be good.

              Yes, I have different macros for different bed and hot end temperatures. There aren't all that many combinations. Now that we have conditional gcode, I could probably simplify that but I haven't had time to look at that yet. Something along the lines of "If filament type is AAA then set be temp to XX and hot end to YY, else if" ....etc

              For now, I just need to remember to call the correct macro from the slicer start gcode. But another advantage is that if I sliced an object and printed it with PLA, if I wanted to print it using say PET-G and the only differences are the hot end a bed temperature, then all I have to do is edit the line at the start of the gcode to call a different macro.

              Things are little more complicated for me because I use multiple tools and a mixing hot end but here is an example of a macro which sets the bed to 40 and waits, then sets it to 50 and runs home all and sets the hot end to 185 .

              M291 P"Heating bed" R"Pre-Print Macro" S1 T10

              M190 S40; start heating bed and wait for it to get to 40

              M291 P"Homing all axes" R"Pre-Print Macro" S1 T10

              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 S185 R185
              G10 P1 S185 R185
              G10 P2 S185 R185
              G10 P3 S185 R185
              G10 P4 S185 R185
              G10 P5 S185 R185

              G1 X80 Y363 F9000 ; move to rear
              M83;

              M291 P"Waiting for heaters to reach active temperatures" R"Pre-Print Macro" S1 T10

              M116 ; wait for all temps including hot end

              The M291 commands are just messages which are optional. The 28 runs the home all macro so you can call other macros from within a macro. Actually, I also call another macro to wipe the nozzle once the temperatures are up to their set point but I omitted that from the above example.

              In slic3R I set all the temperatures to zero which suppresses any M104, M09 , M140, M190 commands. Then I just have this in the custom start gcode.

              M98 P"0:/macros/PrePostPrintMacros/PrePrint9ToolBed50T185"

              The end gcode links to a separate macro which basically just turns off all the heaters (M140 S0, G10 S0 R0).

              HTH

              Ian
              https://somei3deas.wordpress.com/
              https://www.youtube.com/@deckingman

              KeithWundefined 1 Reply Last reply Reply Quote 0
              • KeithWundefined
                KeithW @deckingman
                last edited by

                @deckingman

                So does it matter what the file extension of the macro is? Do you upload the macros to the printer?

                deckingmanundefined 1 Reply Last reply Reply Quote 0
                • deckingmanundefined
                  deckingman @KeithW
                  last edited by

                  @KeithW Macro files can be ".g" or you can leave them blank with no extension. I like to upload macros to a "macros" folder on the SD card. When you call a macro, just put the full path in - like the M98 example above. In my case I have a "macros" folder and within that I have a folder called "PrePostPrintMacros".

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

                  1 Reply Last reply Reply Quote 0
                  • appjawsundefined
                    appjaws
                    last edited by

                    @KeithW I think this is the S3D format.
                    M104 S[extruder0_temperature]
                    M140 S[bed_temperature]
                    Hope this helps

                    I use macros in my start up as well as @deckingman

                    Starting Script
                    M98 P"0:/macros/Set LED Red"
                    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
                    G28
                    M98 P"0:/macros/Conditional/Auto_Bed_Levelling.g"
                    M98 P"0:/macros/Nozzle Cleaning.g"
                    T0
                    G92 E0 ; reset extruder distance
                    M98 P"0:/macros/Set LED Blue"

                    and this is my Ending Script
                    M104 S0 ; turn off extruder
                    M140 S0 ; turn off bed
                    M106 S0 ; turn fan off
                    G1 E-2.5 ; retract extruder 2.5mm
                    G91 ; set relative move
                    G1 Z5 F1000 ; move bed down 5mm
                    G90 ; set absolute move
                    G1 Y228 X100 F3000 ; Park position
                    M98 P"0:/macros/Set LED Green"
                    M291 P"Print Completed " S1 T5; Display message

                    This is my Auto Bed Levelling macro
                    ; Conditional auto bed levelling using 3 Z motors
                    M561 ; clear any existing bed transforms
                    M98 P"0:/macros/Set LED Red"
                    ;check heaters
                    M291 P"Preheating bed and nozzle for accurate probing"
                    if heat.heaters[0].current <=65 && heat.heaters[1].current <=195
                    if heat.heaters[0].current <50
                    M140 S50 ; Set bed temperature to 50
                    M116 ; waiting for bed to reach temperature
                    M140 S65
                    if heat.heaters[1].current <195
                    M104 S195 ; Set current tool temperature to 195C
                    M116 S3 ; waiting for heaters to reach temperature

                    ; If the printer hasn't been homed, home it
                    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
                    G28

                    ;Run an initial 3-point Probe
                    M291 P"auto bed levelling using 3 Z motors started"
                    M98 P"0:/macros/Bedlevel Settings"
                    while true
                    if iterations = 6
                    M291 P"auto bed levelling FAILED"
                    M140 S0 ; Set bed temperature to 0C
                    M104 S0 ; Set current tool temperature to 0C
                    G1 X50 Y230 F24000 ; move the head to park
                    abort "Too many auto calibration attempts"
                    echo "Test = ", iterations+1
                    if move.calibration.initial.deviation < 0.01
                    if move.calibration.final.deviation < move.calibration.initial.deviation + 0.005
                    if move.calibration.final.deviation > move.calibration.initial.deviation - 0.005
                    break
                    echo "Repeating calibration because Initial Deviation (" ^ move.calibration.initial.deviation ^ "mm) must be < 0.01"
                    echo "and Final Deviation (" ^ move.calibration.final.deviation ^ "mm) must be within 0.005 of initialDeviation"
                    M291 P{"Test " ^iterations+1^" Initial Deviation " ^move.calibration.initial.deviation^" Final Deviation " ^move.calibration.final.deviation}

                    M98 P"0:/macros/Bedlevel Settings"
                    

                    echo "Auto calibration successful, Initial Deviation", move.calibration.initial.deviation ^ "mm"
                    echo "Auto calibration successful, Final Deviation", move.calibration.final.deviation ^ "mm"
                    M291 P{"Calibration Success, Initial Deviation " ^move.calibration.initial.deviation ^" Final Deviation " ^move.calibration.final.deviation}
                    G1 X150 Y100 F3000 ; move the head centre
                    G30 ; Probe and set Z Trigger height
                    G1 X50 Y228 F24000 ; move the head to park
                    M98 P"0:/macros/Set LED Green"
                    M291 P"Auto bed levelling using 3 Z motors completed, head moved to park position"

                    appjaws - Core XYUV Duet Ethernet Duex5
                    firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
                    Ormerod 1-converted to laser engraver, Duet wifi
                    OpenSCAD version 2024.03.18
                    Simplify3D 5.1.2

                    1 Reply Last reply Reply Quote 0
                    • KeithWundefined
                      KeithW
                      last edited by

                      @deckingman @appjaws @dc42 Thanks all, I think between all this there is something I can use.

                      I will look at the macros tomorrow. In the mean time my PrintBite has a bubble under it now for some reason after 4 years of use so I have to take it off and reapply it so a night of removing adhesive is on the cards.

                      1 Reply Last reply Reply Quote 0
                      • Phaedruxundefined
                        Phaedrux Moderator @KeithW
                        last edited by

                        @KeithW said in Setting Print and Bed temperatures in start code:

                        @Phaedrux said in Setting Print and Bed temperatures in start code:

                        Do you have two tools, or just one?

                        Just the one.

                        Ok so then I think part of the problem is the M104 T1 that you're getting out of S3D. I'm not a S3D user, but You'll have to change it so that it's only outputting T0 commands.

                        If you combine that with Appjaws variable formatting for S3D I think you'll be good to go without having to go the macro route.

                        Z-Bot CoreXY Build | Thingiverse Profile

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA