diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index de9c1015b..e9c273780 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -1691,6 +1691,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h
index de9c1015b..e9c273780 100755
--- a/Marlin/src/config/default/Configuration_adv.h
+++ b/Marlin/src/config/default/Configuration_adv.h
@@ -1691,6 +1691,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
index 9a66d6906..970b201cd 100644
--- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
+++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h
index 15899240f..2ff456d28 100644
--- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h
+++ b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h
index 15899240f..2ff456d28 100644
--- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h
+++ b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h
index e44b75091..c49c0f9aa 100644
--- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h
+++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h
@@ -1689,6 +1689,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h
index 960f71758..62a4127bf 100644
--- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h
+++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/ArmEd/Configuration_adv.h b/Marlin/src/config/examples/ArmEd/Configuration_adv.h
index b0259df42..c8c823e33 100644
--- a/Marlin/src/config/examples/ArmEd/Configuration_adv.h
+++ b/Marlin/src/config/examples/ArmEd/Configuration_adv.h
@@ -1664,6 +1664,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
index 0290c42d1..b77d57bbb 100644
--- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
+++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
@@ -1689,6 +1689,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h
index 83c2de2fe..87426b386 100644
--- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h
+++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
index e4c67c895..6b02701fc 100644
--- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
+++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
index 9fdf4e428..0e46abc1b 100644
--- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
+++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
@@ -1697,6 +1697,19 @@
#ifdef G0_FEEDRATE
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
index e4c67c895..6b02701fc 100644
--- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
+++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h
index cd3f21730..0c574a9b8 100644
--- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h
+++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
index 33dca58df..944ee1db9 100755
--- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
@@ -1693,6 +1693,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h
index 7320d4f91..9a856c648 100644
--- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h
index 417925a2c..689bb1681 100644
--- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h
index 5b8d3c5f5..da34a421b 100644
--- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h
index 4f38bcae8..d2ff9289b 100644
--- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h
index 8a5daeb0a..6a556568a 100644
--- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h
index 4594d85e4..2224cd3c9 100644
--- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h
+++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h
index 9930139e4..78aacb61c 100644
--- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h
+++ b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h
index 613938999..c425e5e89 100644
--- a/Marlin/src/config/examples/Felix/Configuration_adv.h
+++ b/Marlin/src/config/examples/Felix/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
index 084ef9a07..1b0209a6b 100644
--- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
+++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h
index 964de539d..6be3a02d1 100644
--- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h
+++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h
index bfff9cd95..ad385fdcb 100644
--- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h
+++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h
@@ -1694,6 +1694,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h
index b3d423039..270e6f7e1 100644
--- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h
+++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h
@@ -1695,6 +1695,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h
index 13b4448e0..0cb4ac458 100644
--- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h
+++ b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h
@@ -1676,6 +1676,18 @@
*/
#define FASTER_GCODE_PARSER
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h
index 2f9ae9eae..fb631297b 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h
index 2f9ae9eae..fb631297b 100644
--- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h
+++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
index d1ef05b4d..a310eb1fd 100644
--- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
+++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h
index 0a65c7784..f731003c2 100644
--- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h
+++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h
index c39e91a7a..672781e4d 100644
--- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h
+++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
index 96e9f21a7..30062018a 100644
--- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
+++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
index 49a9126b9..8c1bf6a6e 100644
--- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
+++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
index d378f46b6..bf26b8846 100644
--- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
+++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
index b3977b2d7..6f1365bef 100644
--- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
+++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
@@ -1698,6 +1698,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h
index 9775520b5..b9751f915 100644
--- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h
+++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h
index 4a960304b..81dd0a46d 100644
--- a/Marlin/src/config/examples/SCARA/Configuration_adv.h
+++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
index 4071f721e..b2fd2efb0 100644
--- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
+++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h
index b4c498c8b..4b3f85eb8 100644
--- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h
+++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
index 6dfbc9902..e7326dc44 100644
--- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
+++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h
index b6a32f3bb..5e7c1501e 100644
--- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h
+++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
index 4b841c091..b974fc03f 100644
--- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
+++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
index 4ca547705..605bce04a 100644
--- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
+++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
@@ -1703,6 +1703,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
index 77ffaa188..2649829f5 100644
--- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
+++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
index 9a8a234b5..f30b97a1b 100644
--- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
+++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h
index 50c6d0853..376f359d8 100644
--- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
index 4337f6203..07a7f6303 100644
--- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h
index 4337f6203..07a7f6303 100644
--- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
index a2a175cdc..a5bd5af9b 100644
--- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h
index 9dafd9cc8..6835432c5 100644
--- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h
@@ -1665,6 +1665,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h
index a2a175cdc..a5bd5af9b 100644
--- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
index a2a175cdc..a5bd5af9b 100644
--- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
index 462d51ea9..4c319979b 100644
--- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
+++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
@@ -1692,6 +1692,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
index 615fb398f..1012a6a56 100644
--- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
+++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h
index be1b1c0e4..c28b1ede8 100644
--- a/Marlin/src/config/examples/makibox/Configuration_adv.h
+++ b/Marlin/src/config/examples/makibox/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
index 751914c8f..0ed22b85f 100644
--- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
+++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
@@ -1690,6 +1690,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h
index ac751eb77..fa46e8f2b 100644
--- a/Marlin/src/config/examples/wt150/Configuration_adv.h
+++ b/Marlin/src/config/examples/wt150/Configuration_adv.h
@@ -1691,6 +1691,18 @@
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
+/**
+ * G-code Macros
+ *
+ * Add G-codes M810-M819 to define and run G-code macros.
+ * Macros are not saved to EEPROM.
+ */
+//#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
+
/**
* User-defined menu items that execute custom GCode
*/
diff --git a/Marlin/src/gcode/feature/macro/M810-M819.cpp b/Marlin/src/gcode/feature/macro/M810-M819.cpp
new file mode 100644
index 000000000..3e8a0e04b
--- /dev/null
+++ b/Marlin/src/gcode/feature/macro/M810-M819.cpp
@@ -0,0 +1,67 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#include "../../../inc/MarlinConfig.h"
+
+#if ENABLED(GCODE_MACROS)
+
+#include "../../gcode.h"
+#include "../../queue.h"
+#include "../../parser.h"
+
+char gcode_macros[GCODE_MACROS_SLOTS][GCODE_MACROS_SLOT_SIZE + 1] = {{ 0 }};
+
+/**
+ * M810_819: Set/execute a G-code macro.
+ *
+ * Usage:
+ * M810 |... Set Macro 0 to the given commands, separated by the pipe character
+ * M810 Execute Macro 0
+ */
+void GcodeSuite::M810_819() {
+ const uint8_t index = parser.codenum - 810;
+ if (index >= GCODE_MACROS_SLOTS) return;
+
+ const size_t len = strlen(parser.string_arg);
+
+ if (len) {
+ // Set a macro
+ if (len > GCODE_MACROS_SLOT_SIZE) {
+ SERIAL_ERROR_START();
+ SERIAL_ERRORLNPGM("Macro too long.");
+ }
+ else {
+ char c, *s = parser.string_arg, *d = gcode_macros[index];
+ do {
+ c = *s++;
+ *d++ = c == '|' ? '\n' : c;
+ } while (c);
+ }
+ }
+ else {
+ // Execute a macro
+ char * const cmd = gcode_macros[index];
+ if (strlen(cmd)) process_subcommands_now(cmd);
+ }
+}
+
+#endif // GCODE_MACROS
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index 0d26e8668..1281f4519 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -624,6 +624,12 @@ void GcodeSuite::process_parsed_command(
case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows
#endif
+ #if ENABLED(GCODE_MACROS)
+ case 810: case 811: case 812: case 813: case 814:
+ case 815: case 816: case 817: case 818: case 819:
+ M810_819(); break; // M810-M819: Define/execute G-code macro
+ #endif
+
#if ENABLED(LIN_ADVANCE)
case 900: M900(); break; // M900: Set advance K factor.
#endif
diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h
index 9e3e551eb..cb29abed5 100644
--- a/Marlin/src/gcode/gcode.h
+++ b/Marlin/src/gcode/gcode.h
@@ -211,8 +211,9 @@
* M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE)
* M665 - Set delta configurations: "M665 H L R S B X Y Z (Requires DELTA)
* M666 - Set/get offsets for delta (Requires DELTA) or dual endstops (Requires [XYZ]_DUAL_ENDSTOPS).
- * M701 - Load filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
- * M702 - Unload filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
+ * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES)
+ * M702 - Unload filament (Requires FILAMENT_LOAD_UNLOAD_GCODES)
+ * M810-M819 - Define/execute a G-code macro (Requires GCODE_MACROS)
* M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)
* M852 - Set skew factors: "M852 [I] [J] [K]". (Requires SKEW_CORRECTION_GCODE, and SKEW_CORRECTION_FOR_Z for IJ)
* M860 - Report the position of position encoder modules.
@@ -760,6 +761,10 @@ private:
static void M7219();
#endif
+ #if ENABLED(GCODE_MACROS)
+ static void M810_819();
+ #endif
+
#if HAS_BED_PROBE
static void M851();
#endif
diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp
index 7c3fe76b6..2b678d7e2 100644
--- a/Marlin/src/gcode/parser.cpp
+++ b/Marlin/src/gcode/parser.cpp
@@ -209,7 +209,14 @@ void GCodeParser::parse(char *p) {
#endif
// Only use string_arg for these M codes
- if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; }
+ if (letter == 'M') switch (codenum) {
+ #if ENABLED(GCODE_MACROS)
+ case 810: case 811: case 812: case 813: case 814:
+ case 815: case 816: case 817: case 818: case 819:
+ #endif
+ case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return;
+ default: break;
+ }
#if ENABLED(DEBUG_GCODE_PARSER)
const bool debug = codenum == 800;
diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp
index 57d26dec7..70c2b3e0c 100644
--- a/Marlin/src/gcode/queue.cpp
+++ b/Marlin/src/gcode/queue.cpp
@@ -188,7 +188,8 @@ void enqueue_and_echo_commands_P(PGM_P const pgcode) {
#if HAS_QUEUE_NOW
/**
- * Enqueue and return only when commands are actually enqueued
+ * Enqueue and return only when commands are actually enqueued.
+ * Never call this from a G-code handler!
*/
void enqueue_and_echo_command_now(const char* cmd) {
while (!enqueue_and_echo_command(cmd)) idle();
@@ -196,6 +197,7 @@ void enqueue_and_echo_commands_P(PGM_P const pgcode) {
#if HAS_LCD_QUEUE_NOW
/**
* Enqueue from program memory and return only when commands are actually enqueued
+ * Never call this from a G-code handler!
*/
void enqueue_and_echo_commands_now_P(PGM_P const pgcode) {
enqueue_and_echo_commands_P(pgcode);
diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h
index b331c1c23..a20ab25a7 100644
--- a/Marlin/src/inc/Conditionals_post.h
+++ b/Marlin/src/inc/Conditionals_post.h
@@ -1619,7 +1619,7 @@
// If platform requires early initialization of watchdog to properly boot
#define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM))
-#define USE_EXECUTE_COMMANDS_IMMEDIATE ENABLED(G29_RETRY_AND_RECOVER)
+#define USE_EXECUTE_COMMANDS_IMMEDIATE (ENABLED(G29_RETRY_AND_RECOVER) || ENABLED(GCODE_MACROS))
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
#define Z_STEPPER_COUNT 3
diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h
index 9199b187f..2fd385aad 100644
--- a/Marlin/src/inc/SanityCheck.h
+++ b/Marlin/src/inc/SanityCheck.h
@@ -1962,3 +1962,7 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m
#if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
#error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
#endif
+
+#if ENABLED(GCODE_MACROS) && !WITHIN(GCODE_MACROS_SLOTS, 1, 10)
+ #error "GCODE_MACROS_SLOTS must be a number from 1 to 10."
+#endif
diff --git a/buildroot/share/tests/teensy35_tests b/buildroot/share/tests/teensy35_tests
index abfdc23f1..185c960c1 100755
--- a/buildroot/share/tests/teensy35_tests
+++ b/buildroot/share/tests/teensy35_tests
@@ -35,6 +35,7 @@ exec_test $1 $2 "Teensy3.5 with many features"
restore_configs
opt_enable EEPROM_SETTINGS \
Z_PROBE_SLED AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE
+opt_enable_adv GCODE_MACROS
exec_test $1 $2 "Sled Z Probe with Linear leveling"
#