My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menu_custom.cpp 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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. // Custom User Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if BOTH(HAS_LCD_MENU, CUSTOM_USER_MENUS)
  27. #include "menu.h"
  28. #include "../../gcode/queue.h"
  29. #ifdef USER_SCRIPT_DONE
  30. #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE
  31. #else
  32. #define _DONE_SCRIPT ""
  33. #endif
  34. void _lcd_user_gcode(PGM_P const cmd) {
  35. queue.inject_P(cmd);
  36. TERN_(USER_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback());
  37. TERN_(USER_SCRIPT_RETURN, ui.return_to_status());
  38. }
  39. void menu_user() {
  40. START_MENU();
  41. BACK_ITEM(MSG_MAIN);
  42. #define HAS_USER_ITEM(N) (defined(USER_DESC_##N) && defined(USER_GCODE_##N))
  43. #define USER_ITEM(N) ACTION_ITEM_P(PSTR(USER_DESC_##N), []{ _lcd_user_gcode(PSTR(USER_GCODE_##N _DONE_SCRIPT)); });
  44. #if HAS_USER_ITEM(1)
  45. USER_ITEM(1);
  46. #endif
  47. #if HAS_USER_ITEM(2)
  48. USER_ITEM(2);
  49. #endif
  50. #if HAS_USER_ITEM(3)
  51. USER_ITEM(3);
  52. #endif
  53. #if HAS_USER_ITEM(4)
  54. USER_ITEM(4);
  55. #endif
  56. #if HAS_USER_ITEM(5)
  57. USER_ITEM(5);
  58. #endif
  59. #if HAS_USER_ITEM(6)
  60. USER_ITEM(6);
  61. #endif
  62. #if HAS_USER_ITEM(7)
  63. USER_ITEM(7);
  64. #endif
  65. #if HAS_USER_ITEM(8)
  66. USER_ITEM(8);
  67. #endif
  68. #if HAS_USER_ITEM(9)
  69. USER_ITEM(9);
  70. #endif
  71. #if HAS_USER_ITEM(10)
  72. USER_ITEM(10);
  73. #endif
  74. #if HAS_USER_ITEM(11)
  75. USER_ITEM(11);
  76. #endif
  77. #if HAS_USER_ITEM(12)
  78. USER_ITEM(12);
  79. #endif
  80. #if HAS_USER_ITEM(13)
  81. USER_ITEM(13);
  82. #endif
  83. #if HAS_USER_ITEM(14)
  84. USER_ITEM(14);
  85. #endif
  86. #if HAS_USER_ITEM(15)
  87. USER_ITEM(15);
  88. #endif
  89. #if HAS_USER_ITEM(16)
  90. USER_ITEM(16);
  91. #endif
  92. #if HAS_USER_ITEM(17)
  93. USER_ITEM(17);
  94. #endif
  95. #if HAS_USER_ITEM(18)
  96. USER_ITEM(18);
  97. #endif
  98. #if HAS_USER_ITEM(19)
  99. USER_ITEM(19);
  100. #endif
  101. #if HAS_USER_ITEM(20)
  102. USER_ITEM(20);
  103. #endif
  104. #if HAS_USER_ITEM(21)
  105. USER_ITEM(21);
  106. #endif
  107. #if HAS_USER_ITEM(22)
  108. USER_ITEM(22);
  109. #endif
  110. #if HAS_USER_ITEM(23)
  111. USER_ITEM(23);
  112. #endif
  113. #if HAS_USER_ITEM(24)
  114. USER_ITEM(24);
  115. #endif
  116. #if HAS_USER_ITEM(25)
  117. USER_ITEM(25);
  118. #endif
  119. END_MENU();
  120. }
  121. #endif // HAS_LCD_MENU && CUSTOM_USER_MENUS