Auto Z offset calibration
-
@Proschi78
Have you declared the global variables ?
-
@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