|
| 1 | +/** |
| 2 | + * Marlin 3D Printer Firmware |
| 3 | + * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] |
| 4 | + * |
| 5 | + * Based on Sprinter and grbl. |
| 6 | + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + */ |
| 22 | + |
| 23 | +#include "../../../inc/MarlinConfig.h" |
| 24 | + |
| 25 | +#if ENABLED(GCODE_MACROS) |
| 26 | + |
| 27 | +#include "../../gcode.h" |
| 28 | +#include "../../queue.h" |
| 29 | +#include "../../parser.h" |
| 30 | + |
| 31 | +extern char gcode_macros[GCODE_MACROS_SLOTS][GCODE_MACROS_SLOT_SIZE + 1]; |
| 32 | + |
| 33 | +/** |
| 34 | + * M820: List defined M810 - M819 macros |
| 35 | + */ |
| 36 | +void GcodeSuite::M820() { |
| 37 | + SERIAL_ECHOLNPGM(STR_STORED_MACROS); |
| 38 | + bool some = false; |
| 39 | + for (uint8_t i = 0; i < GCODE_MACROS_SLOTS; ++i) { |
| 40 | + const char *cmd = gcode_macros[i]; |
| 41 | + if (*cmd) { |
| 42 | + SERIAL_ECHO(F("M81"), i, C(' ')); |
| 43 | + char c; |
| 44 | + while ((c = *cmd++)) SERIAL_CHAR(c == '\n' ? '|' : c); |
| 45 | + SERIAL_EOL(); |
| 46 | + some = true; |
| 47 | + } |
| 48 | + } |
| 49 | + if (!some) SERIAL_ECHOLNPGM("None"); |
| 50 | +} |
| 51 | + |
| 52 | +#endif // GCODE_MACROS |
0 commit comments