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.9KB

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