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_main.cpp 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. // 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 MACHINE_CAN_STOP
  39. void menu_abort_confirm() {
  40. do_select_screen(PSTR(MSG_BUTTON_STOP), PSTR(MSG_BACK), ui.abort_print, ui.goto_previous_screen, PSTR(MSG_STOP_PRINT), nullptr, PSTR("?"));
  41. }
  42. #endif // MACHINE_CAN_STOP
  43. #if ENABLED(PRUSA_MMU2)
  44. #include "../../lcd/menu/menu_mmu2.h"
  45. #endif
  46. void menu_tune();
  47. void menu_motion();
  48. void menu_temperature();
  49. void menu_configuration();
  50. #if ENABLED(CUSTOM_USER_MENUS)
  51. void menu_user();
  52. #endif
  53. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  54. void menu_temp_e0_filament_change();
  55. void menu_change_filament();
  56. #endif
  57. #if ENABLED(LCD_INFO_MENU)
  58. void menu_info();
  59. #endif
  60. #if ENABLED(LED_CONTROL_MENU)
  61. void menu_led();
  62. #endif
  63. #if ENABLED(MIXING_EXTRUDER)
  64. void menu_mixer();
  65. #endif
  66. #if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER)
  67. #if SERVICE_INTERVAL_1 > 0
  68. void menu_service1();
  69. #endif
  70. #if SERVICE_INTERVAL_2 > 0
  71. void menu_service2();
  72. #endif
  73. #if SERVICE_INTERVAL_3 > 0
  74. void menu_service3();
  75. #endif
  76. #endif
  77. void menu_main() {
  78. START_MENU();
  79. MENU_BACK(MSG_WATCH);
  80. const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning()
  81. #if ENABLED(SDSUPPORT)
  82. , card_detected = card.isDetected()
  83. , card_open = card_detected && card.isFileOpen()
  84. #endif
  85. ;
  86. if (busy) {
  87. #if MACHINE_CAN_PAUSE
  88. MENU_ITEM(function, MSG_PAUSE_PRINT, ui.pause_print);
  89. #endif
  90. #if MACHINE_CAN_STOP
  91. MENU_ITEM(submenu, MSG_STOP_PRINT, menu_abort_confirm);
  92. #endif
  93. MENU_ITEM(submenu, MSG_TUNE, menu_tune);
  94. }
  95. else {
  96. #if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
  97. //
  98. // Autostart
  99. //
  100. #if ENABLED(MENU_ADDAUTOSTART)
  101. if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
  102. #endif
  103. if (card_detected) {
  104. if (!card_open) {
  105. MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
  106. MENU_ITEM(gcode,
  107. #if PIN_EXISTS(SD_DETECT)
  108. MSG_CHANGE_SDCARD, PSTR("M21")
  109. #else
  110. MSG_RELEASE_SDCARD, PSTR("M22")
  111. #endif
  112. );
  113. }
  114. }
  115. else {
  116. #if PIN_EXISTS(SD_DETECT)
  117. MENU_ITEM(function, MSG_NO_CARD, nullptr);
  118. #else
  119. MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));
  120. MENU_ITEM(function, MSG_SD_RELEASED, nullptr);
  121. #endif
  122. }
  123. #endif // !HAS_ENCODER_WHEEL && SDSUPPORT
  124. #if MACHINE_CAN_PAUSE
  125. const bool paused = (print_job_timer.isPaused()
  126. #if ENABLED(SDSUPPORT)
  127. || card.isPaused()
  128. #endif
  129. );
  130. if (paused) MENU_ITEM(function, MSG_RESUME_PRINT, ui.resume_print);
  131. #endif
  132. MENU_ITEM(submenu, MSG_MOTION, menu_motion);
  133. }
  134. MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
  135. #if ENABLED(MIXING_EXTRUDER)
  136. MENU_ITEM(submenu, MSG_MIXER, menu_mixer);
  137. #endif
  138. #if ENABLED(MMU2_MENUS)
  139. if (!busy) MENU_ITEM(submenu, MSG_MMU2_MENU, menu_mmu2);
  140. #endif
  141. MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration);
  142. #if ENABLED(CUSTOM_USER_MENUS)
  143. MENU_ITEM(submenu, MSG_USER_MENU, menu_user);
  144. #endif
  145. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  146. #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
  147. if (thermalManager.targetHotEnoughToExtrude(active_extruder))
  148. MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
  149. else
  150. MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_temp_e0_filament_change);
  151. #else
  152. MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_change_filament);
  153. #endif
  154. #endif
  155. #if ENABLED(LCD_INFO_MENU)
  156. MENU_ITEM(submenu, MSG_INFO_MENU, menu_info);
  157. #endif
  158. #if ENABLED(LED_CONTROL_MENU)
  159. MENU_ITEM(submenu, MSG_LED_CONTROL, menu_led);
  160. #endif
  161. //
  162. // Switch power on/off
  163. //
  164. #if HAS_POWER_SWITCH
  165. if (powersupply_on)
  166. MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
  167. else
  168. MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
  169. #endif
  170. #if HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT)
  171. //
  172. // Autostart
  173. //
  174. #if ENABLED(MENU_ADDAUTOSTART)
  175. if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
  176. #endif
  177. if (card_detected) {
  178. if (!card_open) {
  179. MENU_ITEM(gcode,
  180. #if PIN_EXISTS(SD_DETECT)
  181. MSG_CHANGE_SDCARD, PSTR("M21")
  182. #else
  183. MSG_RELEASE_SDCARD, PSTR("M22")
  184. #endif
  185. );
  186. MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
  187. }
  188. }
  189. else {
  190. #if PIN_EXISTS(SD_DETECT)
  191. MENU_ITEM(function, MSG_NO_CARD, nullptr);
  192. #else
  193. MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));
  194. MENU_ITEM(function, MSG_SD_RELEASED, nullptr);
  195. #endif
  196. }
  197. #endif // HAS_ENCODER_WHEEL && SDSUPPORT
  198. #if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER)
  199. #if SERVICE_INTERVAL_1 > 0
  200. MENU_ITEM(submenu, SERVICE_NAME_1, menu_service1);
  201. #endif
  202. #if SERVICE_INTERVAL_2 > 0
  203. MENU_ITEM(submenu, SERVICE_NAME_2, menu_service2);
  204. #endif
  205. #if SERVICE_INTERVAL_3 > 0
  206. MENU_ITEM(submenu, SERVICE_NAME_3, menu_service3);
  207. #endif
  208. #endif
  209. #if HAS_GAMES && DISABLED(LCD_INFO_MENU)
  210. MENU_ITEM(submenu, "Game", (
  211. #if HAS_GAME_MENU
  212. menu_game
  213. #elif ENABLED(MARLIN_BRICKOUT)
  214. brickout.enter_game
  215. #elif ENABLED(MARLIN_INVADERS)
  216. invaders.enter_game
  217. #elif ENABLED(MARLIN_SNAKE)
  218. snake.enter_game
  219. #elif ENABLED(MARLIN_MAZE)
  220. maze.enter_game
  221. #endif
  222. ));
  223. #endif
  224. END_MENU();
  225. }
  226. #endif // HAS_LCD_MENU