My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

menu_custom.cpp 2.9KB

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