Welcome! Log In Create A New Profile

Advanced

Marlin - Help with Macros M810

Posted by lukaari 
Marlin - Help with Macros M810
October 15, 2025 01:38AM
Hello,

I’m having trouble loading the macros M810 to M819 after the start.

I’m wondering if it’s possible to add these macros using STARTUP_COMMANDS. If so, could you provide an example?

Thank you,

Edited 2 time(s). Last edit at 10/15/2025 02:08AM by lukaari.
Re: Marlin - Help with Macros M810
October 15, 2025 03:40AM
You enable STARTUP_COMMANDS and add the gcodes you want.

Individual startup gcodes are separated with a \n
multiple gcodes in a GCODE_MACROS are separated with a |

Eg
#define STARTUP_COMMANDS "M810 M300 S440 P50|M117 Tone played\nM811 M300 S660 P250|M117 second tone played"

Will set M810 to "M300 S440 P50|M117 Tone played" and set M811 to "M300 S660 P250|M117 second tone played" on startup

Where the | will be interpreted as a \n when M810-M819 is called


you also have to enable
#define GCODE_MACROS
#if ENABLED(GCODE_MACROS)
#define GCODE_MACROS_SLOTS 5 // Up to 10 may be used
#define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro
#endif

and make sure the size and number is large enough for what you want

Edited 2 time(s). Last edit at 10/15/2025 03:45AM by Dust.
Re: Marlin - Help with Macros M810
October 15, 2025 07:17AM
As a result of this have added a PR to adds some features to GCODE_MACROS including viewing the currently set macros and saving them to eeprom if you want

[github.com]
Re: Marlin - Help with Macros M810
October 15, 2025 12:47PM
Thank you very much — it works perfectly, especially with the beep confirmation !
Since decimal points take up a lot of space, would it be possible to extend the macro length to 100 or 120 characters?

Just to confirm: macros are loaded at startup, but they can be overwritten at any time from the serial terminal — for example, sending a command like M810"" clears that macro, or sending a new M810 command overwrites the previous one. Is that correct?

Also, is there a way to permanently embed certain macros or commands in the code so they cannot be modified by the user, short of writing the new M-commands ?
Re: Marlin - Help with Macros M810
October 15, 2025 09:23PM
"Just to confirm: macros are loaded at startup, but they can be overwritten at any time from the serial terminal — for example, sending a command like M810"" clears that macro, or sending a new M810 command overwrites the previous one. Is that correct?"

Yes they can be over written at any time using gcode M810-M819

No there is no way to lock them without coding and changing things.

Edited 1 time(s). Last edit at 10/15/2025 11:04PM by Dust.
Re: Marlin - Help with Macros M810
October 15, 2025 11:18PM
I understand. Can I call the custom commands form the terminal, or any other solution come to mind ? The only reason is to shorten the length of the commands.

Thank you.
Sorry, only registered users may post in this forum.

Click here to login