Marlin TFT Screen Default scripts for homing Z?

Just loving my Primo. I never got the touch screen to work right and just got used to the V1 Marlin screen and have been using RH on a very twitch old notebook to input the Z homing commands.

I use Ryan’s little Z probe strip (0.5mm thick)

I am curious if and how I can edit the custom commands (script) in the TFT Marlin V1 screen? Right now the Home Z set’s it to -5mm

If I could do that I can just stop using the Notebook as it is kind of a pain

In order to modify V1’s custom menu, you will have to edit the Marlin’s configuration_adv.h for your version of the firmware and reflash the firmware to your board. The section you will be modifying is this one:

 * User-defined menu items that execute custom GCode
  #define CUSTOM_USER_MENU_TITLE "V1 Custom Menu"
  #define USER_SCRIPT_DONE "M117 User Script Done"
  //#define USER_SCRIPT_RETURN  // Return to status screen after a script

  #define USER_DESC_1 "Reset All Coordinates"
  #define USER_GCODE_1 "G92 X0 Y0 Z0"

  #define USER_DESC_2 "Home Z Axis"
  #define USER_GCODE_2 "G28 Z"

  #define USER_DESC_3 "Home X&Y"
  #define USER_GCODE_3 "G28 X Y"

  //#define USER_DESC_4 "Heat Bed/Home/Level"
  //#define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"

  //#define USER_DESC_5 "Home & Info"
  //#define USER_GCODE_5 "G28\nM503"

You can add/modify/reorder any of these lines. Note the ‘\n’ in this commented out line:

//#define USER_GCODE_5 “G28\nM503”

The ‘\n’ inserts a newline into the string and is used to separate multiple g-code commands.

So you can edit the current Z homing to something like this:

  #define USER_DESC_2 "Home Z Axis"
  #define USER_GCODE_2 "G28 Z\nG92 Z0.5\nG0 Z5 F480"

This leaves the Z axis at 5mm which will be 4.5mm above the touch plate. Using this code, since Z will be at 5, you don’t want a G92 Z0 or similar at the top of the g-code file you will be running.

Note that if you don’t want to flash your firmware, your issue can be solved in your CAM software by modifying the start code or other settings. The solution will depend on your CAM solution You could insert a “G92 Z0.5” in the file automatically for example, or alter an existing G92 if you have one. That way your g-code would expect the router to be at 0.5mm rather than at 0.0mm. You could even automatically insert your Z homing sequence at the top of each file your author.

1 Like

Excellent response as always Robert.
I took some previous information from you and used the approach in the Fusion360 CAM but thought would be nice to have the built in scripts work.


@robertbu Once more I “think” I understand and go off to do it and get stumped. Sorry…
I Downloaded from V1:
Unzipped it to>
Folder V1CNC_Skr_Pro_2209-
- firmware.bin

Inside “” I find a single folder “Marlin” which has the file I need to edit the file “configuration_adv.h”
I found it and assume I can edit that file as your laid out for me.

if I do that and then put them both on the microSD
- firmware.bin
And reset my Skr Pro controller does that flash my changed file?

I am sorry if this is not explained too well. I’d be happy to experiment but am afraid to screw up my controller.

You have a bit of a hill to climb. After modifying configuration_adv.h, you have to compile the firmware to produce a new firmware.bin. After that, only the new firmware.bin needs to be on the microSD card. This card is then inserted in the microSD slot on the SKR Pro board, not the slot in the display. Once inserted, you power up the board. If the flashing is successful, the firmware.bin is renamed. I think the new name will be firmware.cur.

Note I don’t have an SKR_Pro board, and have only compiled for my Rambo board, so I cannot anticipate any problems you may have, nor do I know where the firmware.bin files ends up after the compile. It is possible but unlikely that the new firmware.bin will be at the root. If firmware.bin is not updated (check the file date), look in Marlin/buildroot/bin directory. But the starting point is following the PlatformIO instructions. If you have problems, post back, and I’m sure that someone who compiles for the SKR Pro can help you.

Thank you it makes sense now. The actual change is not that important but I would like to learn more about the actual process.

I watched a couple YouTube vids that gave a good overview.

I just built the V1CNC_Skr_Pro_2209 version of the firmware as a test. Note this is the version for serial/series wiring. Firmware.bin ended up in:


I already had Visual Studio Code and PlatformIO installed, and I had the Marlin source unzipped on my machine (due to needed it to answer a forum question). With this setup, the whole process was only about 3 minutes…a couple of minutes to build the index when I first opened the folder, and 48 seconds to compile.

1 Like

SUCCSESS! I was able to do it thanks to your help. I am glad to say I learned a little and installed the Visual Studio Code plugin PlatformIO and somehow hacked my way through it.

Made the changes, built, and compiled. And thanks for telling me where the Firmware.bin was sitting.

I just flashed my controller and all is good!

Only negative item now, I now know how absolutely little I know of software.


Congrats on getting it compiled and uploaded. I too have little understanding of Visual Studio Code or PlatformIO. I only have the recipe that V1 provides for compiling firmware. It is not a place I like to be with a tool, but if I’m only going to be modifying configuration.h and configuration_adv.h, it gets the job done.

Now that you have it compiling, there are other menu items you can add:

  • Move to the middle of the spoilboard.
  • Move to the (0,0) of your fences (if you have them)
  • Release the steppers
  • Save current coordinate
  • Goto saved coordinate
  • etc.

If it makes you feel better, I have been reading/writing C/C++ for 15+ years and I still learn new things every day and I still write code I am not proud of.

One one hand, it is incredibly complicated, in total. There are so many uses and $$$$ going through it that there are new things invented all the time for it.

On the other hand, it is an engineered system. It is pretty far from the “thermodynamics” or “natural” parts of the process. It is designed by people to be understood and used by people. In that way, understanding software is easier than understanding something like biology.

Thanks for the feedback. And one thing I missed retiring from Molex was the chance to get to meet so many interesting engineers working on such new and innovative ideas.

I was of course the lowly “Connector Guy” in so many of the committee meetings but enjoyed hearing all of the development discussions.

It is amazing the good natured help this forum offers and support for the community. I am on some FB groups on other interests I have and I just hate some of the absolutely smart ass replies some people feel they need to toss out there, I guess to feel superior.

1 Like

Heh… Molex is one of our better customers (at least, what they want seems to have a lot of clout in the staff meetings). Lots of tolerance analysis to be done with connectors, I’m sure.

1 Like

Nice to hear that. What products or services do you provide Molex?

I was involved in the product development and tooling. I was brought in when they wanted to venture into what we called then Data connectors in 1983. They were doing really well in Whitegoods and power but not huge in the signal end of the line. They were bought out and went private a little over 7 years ago so I decided to try some other business ideas and retire.

We provide tolerance analysis software. I’m not familiar enough with the engineering to really understand what the guts of the software does, but my understanding is that it takes various values from the models, and then can make some determinations on things like percentage of failures based on the tolerances of those values. i.e., if the length of tab A is +/- .5 mm, 1% of the widgets will fail, but if you can get the tolerance to +/- .25 mm, it goes down to 0.01%; for the same widget, the depth of slot B can go from +/- 1mm to +/- 2mm, and it won’t make any difference. Things like that are nice to know, since it can show where you need to focus your tolerances.

We’re working on a 3D version of the software, and I’m working on the web-based front end, including a versioned repository for individual components.

Interesting. Before I retired part of my responsibilities was shared global engineering solutions. That included our CAD program as well as SAP modules. Been gone seven but still have good contacts.

Can you share a link to your company website? I’d be interested in learning more. We currently use a standardized spreadsheet to do our TAs.

You are our target market… :wink: