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

    M28 M29 problem

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    2
    3
    182
    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.
    • St Tawundefined
      St Taw
      last edited by

      I have a four tool printer and wanting to automate calibration for xy offsets.
      Have created a macro for global variable creation - That OK.
      Have automated tools presented to a camera cross hairs - Jog to location and calculate offsets - Thats OK.
      I can apply the offsets found using G10 command - Thats OK.

      However I want to write the global variables to a file.g Then when the printed is powered up it executes the file and restores the offsets.

      Whilst searching for solutions I find many posts make references to details in docuz which no longer seems to be supported. I have not found an example like the following...

      So my macro to save the global variables is of the form

      M28 "0:/macros/Calibration Values.g" ; Open file
      set global.CameraX=(global.CameraX)
      set global.CameraY=^{global.CameraY}
      set global.CameraZ=global.CameraZ

      set global.T0OffsetX={global.T0OffsetX}
      set global.T0OffsetY={global.T0OffsetY}
      set global.T0OffsetZ={global.T0OffsetZ}

      ....
      M29 ; Close File

      The file it makes is
      set global.CameraX=(global.CameraX)
      set global.CameraY=^{global.CameraY}
      set global.CameraZ=global.CameraZ
      set global.T0OffsetX={global.T0OffsetX}
      set global.T0OffsetY={global.T0OffsetY}
      set global.T0OffsetZ={global.T0OffsetZ}
      set global.T1OffsetX={global.T1OffsetX}
      set global.T1OffsetY={global.T1OffsetY}
      set global.T1OffsetZ={global.T1OffsetZ}
      set global.T2OffsetX={global.T2OffsetX}
      set global.T2OffsetY={global.T2OffsetY}
      set global.T2OffsetZ={global.T2OffsetZ}
      set global.T3OffsetX={global.T3OffsetX}
      set global.T3OffsetY={global.T3OffsetY}
      set global.T3OffsetZ={global.T3OffsetZ}

      As you can see I have tried various formats

      So I am not getting the actual values into the file. I want it to be I believe of the form
      set global.CameraX=6.54
      set global.CameraY=96.740
      set global.CameraZ=0
      ...
      set global.T1OffsetX=0
      set global.T1OffsetY=2.240
      set global.T1OffsetZ=0.2

      Running

      Board: Duet 2 WiFi (2WiFi)
      Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.6 (2023-07-21)
      Duet WiFi Server Version: 1.27

      Thanks for any help

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

        @St-Taw

        You can use the echo command
        https://docs.duet3d.com/User_manual/Reference/Gcode_meta_commands#echo-command

        echo >"test.txt" "set global.myGlobal = " ^ global.myGlobal
        
        St Tawundefined 1 Reply Last reply Reply Quote 1
        • St Tawundefined
          St Taw @OwenD
          last edited by

          @OwenD

          Thanks for quick reply. Have got it working using echo.
          I did see echo before but looked more verbose.

          1 Reply Last reply Reply Quote 0
          • dc42undefined dc42 marked this topic as a question
          • dc42undefined dc42 has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA