What is the purpose of G38.2 Z0.5 for Tiny Touch Plate?

I just completed the assembly of an LR3 CNC and have had some trouble getting it to work until I understood the firmware and how it was set up.

What is the purpose of putting “Z0.5” in the G38.2 command using the tiny touch plate if it doesn’t store that location for Z position? The “0.5” part doesn’t seem to be of any use as far as I can tell because I have to send the “G92 Z0.5” command after using the probe command anyways.

I want to be sure I understand the use of this command correctly and not waste time.

I’ve never done anything in Marlin firmware before and the instructions for PlatformIO/Visual Studio were mostly helpful with the help of some forum posts.

I modeled some custom menu options based on the Rich Auto controllers for manufactured CNC Routers. I work for the company that owns Axiom Precision CNC and while I would love to own one of our Machines, I can’t justify to my wife the spend or the space it would take up in our garage.

LR3 CNC
SKR PRO V1.2 (purchased from V1)
Tiny Touch Plate

In the TFT config.ini I made these
custom_label_8:XY->0
custom_gcode_8:G92 X0 Y0\n
custom_label_9:Tool Set
custom_gcode_9:G38.2 Z0.5\nG92 Z0.5\nG0 Z5\n
custom_label_10:Origin
custom_gcode_10:G0 X0 Y0\n
custom_label_11:Z zero
custom_gcode_11:G92 z0\n

For the Marlin Configuration.adv.h I wrote these

// Custom Menu: Main Menu

#define CUSTOM_MENU_MAIN
#if ENABLED(CUSTOM_MENU_MAIN)
#define CUSTOM_MENU_MAIN_TITLE “V1 Custom Menu” // “Custom Commands”
#define CUSTOM_MENU_MAIN_SCRIPT_DONE “M117 User Script Done”
#define CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK
//#define CUSTOM_MENU_MAIN_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_MAIN_ONLY_IDLE // Only show custom menu when the machine is idle

#define MAIN_MENU_ITEM_1_DESC “Home All”
#define MAIN_MENU_ITEM_1_GCODE “G28 X Y Z”
//#define MAIN_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action

#define MAIN_MENU_ITEM_2_DESC “Tool Set”
#define MAIN_MENU_ITEM_2_GCODE “G38.2 Z0\nG92 Z0.5\nG0 Z5” // Run Touchoff Probe and set Z to 0.5mm thickness of plate
//#define MAIN_MENU_ITEM_2_CONFIRM

#define MAIN_MENU_ITEM_3_DESC “Origin”
#define MAIN_MENU_ITEM_3_GCODE “G0 X0 Y0” // “Return to job origin”
//#define MAIN_MENU_ITEM_3_CONFIRM

#define MAIN_MENU_ITEM_4_DESC “XY->0” // “Set Origin for XY”
#define MAIN_MENU_ITEM_4_GCODE “G92 X0 Y0”
//#define MAIN_MENU_ITEM_4_CONFIRM

#define MAIN_MENU_ITEM_5_DESC “Z zero” //“For fragile bits. Zero Z axis visually or with feeler gauge”
#define MAIN_MENU_ITEM_5_GCODE “G92 Z0”
//#define MAIN_MENU_ITEM_5_CONFIRM

#define MAIN_MENU_ITEM_6_DESC “Home X & Y”
#define MAIN_MENU_ITEM_6_GCODE “G28 X Y”
//#define MAIN_MENU_ITEM_6_CONFIRM

#endif

I found this in the LR3 build docs. However, how does this help in setting up the tool for a job? Is there a way to probe and set the Z origin in the menus without a custom macro?

The way I have started to do this is Home and probe twice on each side. So G28 Z0, G38.2 Z0, M114, G28 Z0, G38.2 Z0, M114, Then move over G0 X1250, G28 Z0, G38.2 Z0, M114, G28 Z0, G38.2 Z0, M114. From there subtract the average of both sides, M666 Z0.5, M500. Then test again. G28 Z0, G38.2 Z0, M114, G28 Z0, G38.2 Z0, M114, Then move over G0 X1250, G28 Z0, G38.2 Z0, M114, G28 Z0, G38.2 Z0, M114.