How to create extra custom commands

@robertbu @jeffeb3
this may be of interest to you and others, in my mission to try to make my MPCNC as “stand alone” as possible i ended up being limited by the lack of “custom commands” within Marlin.
So the hunt was on to change that, and the solution has been found.
What needs to be done is to open the SRC folder of the firmware you are using and find LCD folder, within that you will find the MENU folder and open the "menu_custom.cpp.

if you look at the highlighted sections of the text it normally only gives 5 USER_DESC lines.
Copy and paste as many more as you like and keep numbering them in sequence to create more.

Then in CONFIG H scroll down to the custom commands section and cut and paste more lines to match the number of USER_DESC’s you created in the .CPP.

I have been testing to make sure they work and it seems you can create as many as you like, i got to 150 with random tasks before i got bored and they all worked without issue.

Next job is to try to clean up the menu’s to hide the parts that we just don’t use on a CNC to try to make the screen easier to navigate.

4 Likes

I like it! I wondered if I could add more than the five defined in the config file, but I did not dig any deeper. To me your big find here is that menu_custom.cpp already has 25 possible menu items defined, so the menu could be extended in configuration_Adv.h up to 25 total items without having to mess around with menu_custom…just follow the pattern of the defines. That’s going to be more than enough for most people… Thanks for posting this.

1 Like

@robertbu, i’m running MPCNC_Ramps_T8_16T_LCD_32step_DualEndstop and that only had 5 USER_DESC in the menu_custom.CPP from the outset and what i found is you could create as many custom commands in the ADV.H as you like and they would compile quite happily, but they would never show in the menu system without the changes in the menu_custom.cpp. I don’t know is my firmware is the current issue it can’t be to far off, i think i down loaded it mid December, is there an updated version?

1 Like

I just looked at the latest Ramps release of the firmware that was published on 1/4/21. This is version 509. The menu_custom.cpp file of this version has 25 items defined. In mid-December, you would have downloaded the previous version (508).

Thanks @robertbu worth knowing.