M28 M29 problem
-
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.CameraZset global.T0OffsetX={global.T0OffsetX}
set global.T0OffsetY={global.T0OffsetY}
set global.T0OffsetZ={global.T0OffsetZ}....
M29 ; Close FileThe 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.2Running
Board: Duet 2 WiFi (2WiFi)
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.6 (2023-07-21)
Duet WiFi Server Version: 1.27Thanks for any help
-
You can use the echo command
https://docs.duet3d.com/User_manual/Reference/Gcode_meta_commands#echo-commandecho >"test.txt" "set global.myGlobal = " ^ global.myGlobal
-
Thanks for quick reply. Have got it working using echo.
I did see echo before but looked more verbose. -
-