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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. // Main Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU
  27. #include "menu.h"
  28. #include "../../module/temperature.h"
  29. #include "../../gcode/queue.h"
  30. #include "../../module/printcounter.h"
  31. #include "../../module/stepper.h"
  32. #include "../../sd/cardreader.h"
  33. #if HAS_GAMES && DISABLED(LCD_INFO_MENU)
  34. #include "game/game.h"
  35. #endif
  36. #define MACHINE_CAN_STOP (EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL))
  37. #define MACHINE_CAN_PAUSE (ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE))
  38. #if ENABLED(PRUSA_MMU2)
  39. #include "../../lcd/menu/menu_mmu2.h"
  40. #endif
  41. void menu_tune();
  42. void menu_motion();
  43. void menu_temperature();
  44. void menu_configuration();
  45. #if ENABLED(CUSTOM_USER_MENUS)
  46. void menu_user();
  47. #endif
  48. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  49. void _menu_temp_filament_op(const PauseMode, const int8_t);
  50. void menu_change_filament();
  51. #endif
  52. #if ENABLED(LCD_INFO_MENU)
  53. void menu_info();
  54. #endif
  55. #if ENABLED(LED_CONTROL_MENU)
  56. void menu_led();
  57. #endif
  58. #if HAS_CUTTER
  59. #include "../../feature/spindle_laser.h"
  60. void menu_spindle_laser();
  61. #endif
  62. #if ENABLED(MIXING_EXTRUDER)
  63. void menu_mixer();
  64. #endif
  65. extern const char M21_STR[];
  66. void menu_main() {
  67. START_MENU();
  68. BACK_ITEM(MSG_INFO_SCREEN);
  69. const bool busy = printingIsActive()
  70. #if ENABLED(SDSUPPORT)
  71. , card_detected = card.isMounted()
  72. , card_open = card_detected && card.isFileOpen()
  73. #endif
  74. ;
  75. if (busy) {
  76. #if MACHINE_CAN_PAUSE
  77. ACTION_ITEM(MSG_PAUSE_PRINT, ui.pause_print);
  78. #endif
  79. #if MACHINE_CAN_STOP
  80. SUBMENU(MSG_STOP_PRINT, []{
  81. MenuItem_confirm::select_screen(
  82. GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
  83. ui.abort_print, ui.goto_previous_screen,
  84. GET_TEXT(MSG_STOP_PRINT), (PGM_P)nullptr, PSTR("?")
  85. );
  86. });
  87. #endif
  88. SUBMENU(MSG_TUNE, menu_tune);
  89. }
  90. else {
  91. #if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
  92. // *** IF THIS SECTION IS CHANGED, REPRODUCE BELOW ***
  93. //
  94. // Autostart
  95. //
  96. #if ENABLED(MENU_ADDAUTOSTART)
  97. if (!busy) ACTION_ITEM(MSG_AUTOSTART, card.beginautostart);
  98. #endif
  99. if (card_detected) {
  100. if (!card_open) {
  101. SUBMENU(MSG_MEDIA_MENU, menu_media);
  102. MENU_ITEM(gcode,
  103. #if PIN_EXISTS(SD_DETECT)
  104. MSG_CHANGE_MEDIA, M21_STR
  105. #else
  106. MSG_RELEASE_MEDIA, PSTR("M22")
  107. #endif
  108. );
  109. }
  110. }
  111. else {
  112. #if PIN_EXISTS(SD_DETECT)
  113. ACTION_ITEM(MSG_NO_MEDIA, nullptr);
  114. #else
  115. GCODES_ITEM(MSG_ATTACH_MEDIA, M21_STR);
  116. ACTION_ITEM(MSG_MEDIA_RELEASED, nullptr);
  117. #endif
  118. }
  119. #endif // !HAS_ENCODER_WHEEL && SDSUPPORT
  120. #if MACHINE_CAN_PAUSE
  121. if (printingIsPaused()) ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print);
  122. #endif
  123. SUBMENU(MSG_MOTION, menu_motion);
  124. }
  125. #if HAS_CUTTER
  126. SUBMENU(MSG_CUTTER(MENU), menu_spindle_laser);
  127. #endif
  128. SUBMENU(MSG_TEMPERATURE, menu_temperature);
  129. #if ENABLED(MIXING_EXTRUDER)
  130. SUBMENU(MSG_MIXER, menu_mixer);
  131. #endif
  132. #if ENABLED(MMU2_MENUS)
  133. if (!busy) SUBMENU(MSG_MMU2_MENU, menu_mmu2);
  134. #endif
  135. SUBMENU(MSG_CONFIGURATION, menu_configuration);
  136. #if ENABLED(CUSTOM_USER_MENUS)
  137. #ifdef CUSTOM_USER_MENU_TITLE
  138. SUBMENU_P(PSTR(CUSTOM_USER_MENU_TITLE), menu_user);
  139. #else
  140. SUBMENU(MSG_USER_MENU, menu_user);
  141. #endif
  142. #endif
  143. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  144. #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
  145. if (thermalManager.targetHotEnoughToExtrude(active_extruder))
  146. GCODES_ITEM(MSG_FILAMENTCHANGE, PSTR("M600 B0"));
  147. else
  148. SUBMENU(MSG_FILAMENTCHANGE, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, 0); });
  149. #else
  150. SUBMENU(MSG_FILAMENTCHANGE, menu_change_filament);
  151. #endif
  152. #endif
  153. #if ENABLED(LCD_INFO_MENU)
  154. SUBMENU(MSG_INFO_MENU, menu_info);
  155. #endif
  156. #if ENABLED(LED_CONTROL_MENU)
  157. SUBMENU(MSG_LED_CONTROL, menu_led);
  158. #endif
  159. //
  160. // Switch power on/off
  161. //
  162. #if ENABLED(PSU_CONTROL)
  163. if (powersupply_on)
  164. GCODES_ITEM(MSG_SWITCH_PS_OFF, PSTR("M81"));
  165. else
  166. GCODES_ITEM(MSG_SWITCH_PS_ON, PSTR("M80"));
  167. #endif
  168. #if HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
  169. // *** IF THIS SECTION IS CHANGED, REPRODUCE ABOVE ***
  170. //
  171. // Autostart
  172. //
  173. #if ENABLED(MENU_ADDAUTOSTART)
  174. if (!busy) ACTION_ITEM(MSG_AUTOSTART, card.beginautostart);
  175. #endif
  176. if (card_detected) {
  177. if (!card_open) {
  178. MENU_ITEM(gcode,
  179. #if PIN_EXISTS(SD_DETECT)
  180. MSG_CHANGE_MEDIA, M21_STR
  181. #else
  182. MSG_RELEASE_MEDIA, PSTR("M22")
  183. #endif
  184. );
  185. SUBMENU(MSG_MEDIA_MENU, menu_media);
  186. }
  187. }
  188. else {
  189. #if PIN_EXISTS(SD_DETECT)
  190. ACTION_ITEM(MSG_NO_MEDIA, nullptr);
  191. #else
  192. GCODES_ITEM(MSG_ATTACH_MEDIA, M21_STR);
  193. ACTION_ITEM(MSG_MEDIA_RELEASED, nullptr);
  194. #endif
  195. }
  196. #endif // HAS_ENCODER_WHEEL && SDSUPPORT
  197. #if HAS_SERVICE_INTERVALS
  198. static auto _service_reset = [](const int index) {
  199. print_job_timer.resetServiceInterval(index);
  200. #if HAS_BUZZER
  201. ui.completion_feedback();
  202. #endif
  203. ui.reset_status();
  204. ui.return_to_status();
  205. };
  206. #if SERVICE_INTERVAL_1 > 0
  207. CONFIRM_ITEM_P(PSTR(SERVICE_NAME_1),
  208. MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
  209. []{ _service_reset(1); }, ui.goto_previous_screen,
  210. GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_1), PSTR("?")
  211. );
  212. #endif
  213. #if SERVICE_INTERVAL_2 > 0
  214. CONFIRM_ITEM_P(PSTR(SERVICE_NAME_2),
  215. MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
  216. []{ _service_reset(2); }, ui.goto_previous_screen,
  217. GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_2), PSTR("?")
  218. );
  219. #endif
  220. #if SERVICE_INTERVAL_3 > 0
  221. CONFIRM_ITEM_P(PSTR(SERVICE_NAME_3),
  222. MSG_BUTTON_RESET, MSG_BUTTON_CANCEL,
  223. []{ _service_reset(3); }, ui.goto_previous_screen,
  224. GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_3), PSTR("?")
  225. );
  226. #endif
  227. #endif
  228. #if HAS_GAMES && DISABLED(LCD_INFO_MENU)
  229. #if ENABLED(GAMES_EASTER_EGG)
  230. SKIP_ITEM();
  231. SKIP_ITEM();
  232. SKIP_ITEM();
  233. #endif
  234. // Game sub-menu or the individual game
  235. {
  236. SUBMENU(
  237. #if HAS_GAME_MENU
  238. MSG_GAMES, menu_game
  239. #elif ENABLED(MARLIN_BRICKOUT)
  240. MSG_BRICKOUT, brickout.enter_game
  241. #elif ENABLED(MARLIN_INVADERS)
  242. MSG_INVADERS, invaders.enter_game
  243. #elif ENABLED(MARLIN_SNAKE)
  244. MSG_SNAKE, snake.enter_game
  245. #elif ENABLED(MARLIN_MAZE)
  246. MSG_MAZE, maze.enter_game
  247. #endif
  248. );
  249. }
  250. #endif
  251. END_MENU();
  252. }
  253. #endif // HAS_LCD_MENU