need conditional commands



  • hi there,

    i have set up my machine to home Z after heating up extruder to 150C. However, sometimes i need to change filament or stop a failed print and start over. i generally home Z again because i need to rip off whatever failed which can move the bed. however, the hotend is at a higher temp than 150C and it would wait until it falls to 150c before it starts to home. is there any ways to set it up so that it will home at 150C or greater?



  • The short answer is yes.
    However you have not provided any detail as to what is in any of the various sections of code that could affect this under different circumstances.
    e.g.
    The start & end code for your slicer.
    start.g
    pause.g
    cancel.g
    stop.g

    Presumably somewhere, you have an M106, M116 (or similar) code to wait until the extruder reaches 150c
    In a nutshell, you need to work out when you want that to happen and when you don't.
    Then replace it with a conditional statement .
    something like.

    G10 P0 S150 R100 ; set active and standby temps for tool 1
    T0 ; select tool
    
    if {heat.heaters[1].current < 150} ; check current temp of heater 1 (usually hotend)
            M116  ; if temp is less than 150 we wait, if not move to home
    
    G28 ; home will be executed immediately or after waiting depending on temp condition above
    
    

    You need to ensure that you select the correct tool, heater etc



  • i have a duex5 and the heater in question is heater 2 (which is the first heater on the board). it is also assigned to tool T0.

    Would this be correct?
    if {heat.heaters[2].current < 150}
    M116



  • @tekstyle said in need conditional commands:

    i have a duex5 and the heater in question is heater 2 (which is the first heater on the board). it is also assigned to tool T0.

    Would this be correct?
    if {heat.heaters[2].current < 150}
    M116

    It must match the heater number you have given it in M950 in config.g

    Also the M116 must be indented as shown in my example.
    Otherwise it will run regardless.



  • @OwenD

    thanks for your help. i am not familiar with conditions and its syntax. this totally helps. does duet website have any information on other conditional commands that can be used ( not particular to this OP)?



  • @tekstyle said in need conditional commands:

    @OwenD

    thanks for your help. i am not familiar with conditions and its syntax. this totally helps. does duet website have any information on other conditional commands that can be used ( not particular to this OP)?

    Full documentation of the object model is still coming, but there is enough to get started here.

    https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands

    https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware

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

    Then it's a matter of poking around with M409 and testing using echo or similar


Log in to reply