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

    Auto Z offset calibration

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    6
    22
    1.6k
    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.
    • stuartofmtundefined
      stuartofmt @Proschi3D
      last edited by

      @Proschi78

      Have you declared the global variables ?

      https://forum.duet3d.com/topic/24795/a-couple-of-questions-regarding-global-variables?_=1681490684446

      1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @Proschi3D
        last edited by OwenD

        @Proschi78 said in Auto Z offset calibration:

        {global.tool0 = move.axes[2].machinePosition}

        Should be
        set global.tool0 = move.axes[2].machinePosition
        however it will always be zero (or whatever your axis minima is set to with M208)
        Also no need for curly brackets here.

        Likewise the second calculation is going to return zero (axis minima) because you use H1
        I feel you should be using H4 on the second test at least and that creating the firt global is largely redundant.

        I can't test, but maybe

        G1 Z50 F800
        M291 S3 R"Clean the nozzle" P"The nozzle has been pre-heated. Clean it from any plastic debris"
        G1 Z25 F800
        G4 P0
        M300 S666 P666 ; beep
        M291 S3 P"Place the offset tool below the nozzle and press OK to perform the macro, or CANCEL to abort"
        G29 S2
        G4 P200 ; wait 200ms
        G1 H1 Z-19 F50 ; move 19mm down, stop when hitting the offset tool (but don't risk crashing the bed)
        M400
        set global.tool0 = move.axes[2].machinePosition ; Store the current Z position in tool0
        G1 Z25 F3000
        G28 X0
        T1
        G1 U175 Y110 Z25 F3000
        G1 H4 Z-20 F50 ; Move Z-axis down 20 mm
        M400
        set global.tool1 = move.axes[2].machinePosition - global.tool0 ; Calculate the difference between current Z position and tool0 and store in tool1
        echo "The difference between the two nozzle heights is: " ^ global.tool1 ^ " mm." ; Output the difference to the console
        G4 S15
        G1 Z25 F500
        G28 U0
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA