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_filament.cpp 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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. // Filament Change Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE)
  27. #include "menu.h"
  28. #include "../../module/temperature.h"
  29. #include "../../feature/pause.h"
  30. //
  31. // Change Filament > Change/Unload/Load Filament
  32. //
  33. static AdvancedPauseMode _change_filament_temp_mode; // =ADVANCED_PAUSE_MODE_PAUSE_PRINT
  34. static int8_t _change_filament_temp_extruder; // =0
  35. inline PGM_P _change_filament_temp_command() {
  36. switch (_change_filament_temp_mode) {
  37. case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
  38. return PSTR("M701 T%d");
  39. case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
  40. return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d");
  41. case ADVANCED_PAUSE_MODE_PAUSE_PRINT:
  42. default:
  43. return PSTR("M600 B0 T%d");
  44. }
  45. return PSTR(MSG_FILAMENTCHANGE);
  46. }
  47. static void _change_filament_temp(const uint16_t temperature) {
  48. char cmd[11];
  49. sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder);
  50. thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder);
  51. lcd_enqueue_command(cmd);
  52. }
  53. inline void _lcd_change_filament_temp_1_func() { _change_filament_temp(PREHEAT_1_TEMP_HOTEND); }
  54. inline void _lcd_change_filament_temp_2_func() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); }
  55. inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); }
  56. static PGM_P change_filament_header(const AdvancedPauseMode mode) {
  57. switch (mode) {
  58. case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
  59. return PSTR(MSG_FILAMENTLOAD);
  60. case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
  61. return PSTR(MSG_FILAMENTUNLOAD);
  62. default: break;
  63. }
  64. return PSTR(MSG_FILAMENTCHANGE);
  65. }
  66. void _menu_temp_filament_op(const AdvancedPauseMode mode, const int8_t extruder) {
  67. _change_filament_temp_mode = mode;
  68. _change_filament_temp_extruder = extruder;
  69. START_MENU();
  70. if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), true, true);
  71. MENU_BACK(MSG_BACK);
  72. MENU_ITEM(function, MSG_PREHEAT_1, _lcd_change_filament_temp_1_func);
  73. MENU_ITEM(function, MSG_PREHEAT_2, _lcd_change_filament_temp_2_func);
  74. uint16_t max_temp;
  75. switch (extruder) {
  76. default: max_temp = HEATER_0_MAXTEMP;
  77. #if HOTENDS > 1
  78. case 1: max_temp = HEATER_1_MAXTEMP; break;
  79. #if HOTENDS > 2
  80. case 2: max_temp = HEATER_2_MAXTEMP; break;
  81. #if HOTENDS > 3
  82. case 3: max_temp = HEATER_3_MAXTEMP; break;
  83. #if HOTENDS > 4
  84. case 4: max_temp = HEATER_4_MAXTEMP; break;
  85. #if HOTENDS > 5
  86. case 5: max_temp = HEATER_5_MAXTEMP; break;
  87. #endif
  88. #endif
  89. #endif
  90. #endif
  91. #endif
  92. }
  93. MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PREHEAT_CUSTOM, &thermalManager.target_temperature[_change_filament_temp_extruder], EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_cb);
  94. END_MENU();
  95. }
  96. void menu_temp_e0_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); }
  97. void menu_temp_e0_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 0); }
  98. void menu_temp_e0_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 0); }
  99. #if E_STEPPERS > 1
  100. void menu_temp_e1_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 1); }
  101. void menu_temp_e1_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 1); }
  102. void menu_temp_e1_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 1); }
  103. #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
  104. void menu_unload_filament_all_temp() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, -1); }
  105. #endif
  106. #if E_STEPPERS > 2
  107. void menu_temp_e2_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 2); }
  108. void menu_temp_e2_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 2); }
  109. void menu_temp_e2_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 2); }
  110. #if E_STEPPERS > 3
  111. void menu_temp_e3_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 3); }
  112. void menu_temp_e3_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 3); }
  113. void menu_temp_e3_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 3); }
  114. #if E_STEPPERS > 4
  115. void menu_temp_e4_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 4); }
  116. void menu_temp_e4_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 4); }
  117. void menu_temp_e4_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 4); }
  118. #endif // E_STEPPERS > 4
  119. #endif // E_STEPPERS > 3
  120. #endif // E_STEPPERS > 2
  121. #endif // E_STEPPERS > 1
  122. /**
  123. *
  124. * "Change Filament" submenu
  125. *
  126. */
  127. #if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
  128. void menu_change_filament() {
  129. START_MENU();
  130. MENU_BACK(MSG_MAIN);
  131. // Change filament
  132. #if E_STEPPERS == 1
  133. PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE);
  134. if (thermalManager.targetTooColdToExtrude(active_extruder))
  135. MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change);
  136. else
  137. MENU_ITEM_P(gcode, msg0, PSTR("M600 B0"));
  138. #else
  139. PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE " " MSG_E1);
  140. PGM_P msg1 = PSTR(MSG_FILAMENTCHANGE " " MSG_E2);
  141. if (thermalManager.targetTooColdToExtrude(0))
  142. MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change);
  143. else
  144. MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0"));
  145. if (thermalManager.targetTooColdToExtrude(1))
  146. MENU_ITEM_P(submenu, msg1, menu_temp_e1_filament_change);
  147. else
  148. MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1"));
  149. #if E_STEPPERS > 2
  150. PGM_P msg2 = PSTR(MSG_FILAMENTCHANGE " " MSG_E3);
  151. if (thermalManager.targetTooColdToExtrude(2))
  152. MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_change);
  153. else
  154. MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2"));
  155. #if E_STEPPERS > 3
  156. PGM_P msg3 = PSTR(MSG_FILAMENTCHANGE " " MSG_E4);
  157. if (thermalManager.targetTooColdToExtrude(3))
  158. MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_change);
  159. else
  160. MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3"));
  161. #if E_STEPPERS > 4
  162. PGM_P msg4 = PSTR(MSG_FILAMENTCHANGE " " MSG_E5);
  163. if (thermalManager.targetTooColdToExtrude(4))
  164. MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_change);
  165. else
  166. MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4"));
  167. #if E_STEPPERS > 5
  168. PGM_P msg5 = PSTR(MSG_FILAMENTCHANGE " " MSG_E6);
  169. if (thermalManager.targetTooColdToExtrude(5))
  170. MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_change);
  171. else
  172. MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5"));
  173. #endif // E_STEPPERS > 5
  174. #endif // E_STEPPERS > 4
  175. #endif // E_STEPPERS > 3
  176. #endif // E_STEPPERS > 2
  177. #endif // E_STEPPERS == 1
  178. #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
  179. if (!printer_busy()) {
  180. // Load filament
  181. #if E_STEPPERS == 1
  182. PGM_P msg0 = PSTR(MSG_FILAMENTLOAD);
  183. if (thermalManager.targetTooColdToExtrude(active_extruder))
  184. MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load);
  185. else
  186. MENU_ITEM_P(gcode, msg0, PSTR("M701"));
  187. #else
  188. PGM_P msg0 = PSTR(MSG_FILAMENTLOAD " " MSG_E1);
  189. PGM_P msg1 = PSTR(MSG_FILAMENTLOAD " " MSG_E2);
  190. if (thermalManager.targetTooColdToExtrude(0))
  191. MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load);
  192. else
  193. MENU_ITEM_P(gcode, msg0, PSTR("M701 T0"));
  194. if (thermalManager.targetTooColdToExtrude(1))
  195. MENU_ITEM_P(submenu, msg1, menu_temp_e1_filament_load);
  196. else
  197. MENU_ITEM_P(gcode, msg1, PSTR("M701 T1"));
  198. #if E_STEPPERS > 2
  199. PGM_P msg2 = PSTR(MSG_FILAMENTLOAD " " MSG_E3);
  200. if (thermalManager.targetTooColdToExtrude(2))
  201. MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_load);
  202. else
  203. MENU_ITEM_P(gcode, msg2, PSTR("M701 T2"));
  204. #if E_STEPPERS > 3
  205. PGM_P msg3 = PSTR(MSG_FILAMENTLOAD " " MSG_E4);
  206. if (thermalManager.targetTooColdToExtrude(3))
  207. MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_load);
  208. else
  209. MENU_ITEM_P(gcode, msg3, PSTR("M701 T3"));
  210. #if E_STEPPERS > 4
  211. PGM_P msg4 = PSTR(MSG_FILAMENTLOAD " " MSG_E5);
  212. if (thermalManager.targetTooColdToExtrude(4))
  213. MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_load);
  214. else
  215. MENU_ITEM_P(gcode, msg4, PSTR("M701 T4"));
  216. #if E_STEPPERS > 5
  217. PGM_P msg5 = PSTR(MSG_FILAMENTLOAD " " MSG_E6);
  218. if (thermalManager.targetTooColdToExtrude(5))
  219. MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_load);
  220. else
  221. MENU_ITEM_P(gcode, msg5, PSTR("M701 T5"));
  222. #endif // E_STEPPERS > 5
  223. #endif // E_STEPPERS > 4
  224. #endif // E_STEPPERS > 3
  225. #endif // E_STEPPERS > 2
  226. #endif // E_STEPPERS == 1
  227. // Unload filament
  228. #if E_STEPPERS == 1
  229. if (thermalManager.targetHotEnoughToExtrude(active_extruder))
  230. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702"));
  231. else
  232. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, menu_temp_e0_filament_unload);
  233. #else
  234. #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS)
  235. if (thermalManager.targetHotEnoughToExtrude(0)
  236. #if E_STEPPERS > 1
  237. && thermalManager.targetHotEnoughToExtrude(1)
  238. #if E_STEPPERS > 2
  239. && thermalManager.targetHotEnoughToExtrude(2)
  240. #if E_STEPPERS > 3
  241. && thermalManager.targetHotEnoughToExtrude(3)
  242. #if E_STEPPERS > 4
  243. && thermalManager.targetHotEnoughToExtrude(4)
  244. #if E_STEPPERS > 5
  245. && thermalManager.targetHotEnoughToExtrude(5)
  246. #endif // E_STEPPERS > 5
  247. #endif // E_STEPPERS > 4
  248. #endif // E_STEPPERS > 3
  249. #endif // E_STEPPERS > 2
  250. #endif // E_STEPPERS > 1
  251. )
  252. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD_ALL, PSTR("M702"));
  253. else
  254. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, menu_unload_filament_all_temp);
  255. #endif
  256. if (thermalManager.targetHotEnoughToExtrude(0))
  257. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0"));
  258. else
  259. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, menu_temp_e0_filament_unload);
  260. if (thermalManager.targetHotEnoughToExtrude(1))
  261. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1"));
  262. else
  263. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, menu_temp_e1_filament_unload);
  264. #if E_STEPPERS > 2
  265. if (thermalManager.targetHotEnoughToExtrude(2))
  266. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2"));
  267. else
  268. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, menu_temp_e2_filament_unload);
  269. #if E_STEPPERS > 3
  270. if (thermalManager.targetHotEnoughToExtrude(3))
  271. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3"));
  272. else
  273. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, menu_temp_e3_filament_unload);
  274. #if E_STEPPERS > 4
  275. if (thermalManager.targetHotEnoughToExtrude(4))
  276. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4"));
  277. else
  278. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, menu_temp_e4_filament_unload);
  279. #if E_STEPPERS > 5
  280. if (thermalManager.targetHotEnoughToExtrude(5))
  281. MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E6, PSTR("M702 T5"));
  282. else
  283. MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E6, menu_temp_e5_filament_unload);
  284. #endif // E_STEPPERS > 5
  285. #endif // E_STEPPERS > 4
  286. #endif // E_STEPPERS > 3
  287. #endif // E_STEPPERS > 2
  288. #endif // E_STEPPERS == 1
  289. }
  290. #endif
  291. END_MENU();
  292. }
  293. #endif
  294. static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
  295. static uint8_t hotend_status_extruder = 0;
  296. static PGM_P advanced_pause_header() {
  297. switch (advanced_pause_mode) {
  298. case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
  299. return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
  300. case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT:
  301. return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD);
  302. default: break;
  303. }
  304. return PSTR(MSG_FILAMENT_CHANGE_HEADER_PAUSE);
  305. }
  306. // Portions from STATIC_ITEM...
  307. #define HOTEND_STATUS_ITEM() do { \
  308. if (_menuLineNr == _thisItemNr) { \
  309. if (ui.should_draw()) { \
  310. draw_menu_item_static(_lcdLineNr, PSTR(MSG_FILAMENT_CHANGE_NOZZLE), false, true); \
  311. ui.draw_hotend_status(_lcdLineNr, hotend_status_extruder); \
  312. } \
  313. if (_skipStatic && encoderLine <= _thisItemNr) { \
  314. ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
  315. ++encoderLine; \
  316. } \
  317. ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); \
  318. } \
  319. ++_thisItemNr; \
  320. }while(0)
  321. void lcd_advanced_pause_resume_print() {
  322. advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT;
  323. }
  324. void lcd_advanced_pause_extrude_more() {
  325. advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE;
  326. }
  327. void menu_advanced_pause_option() {
  328. START_MENU();
  329. #if LCD_HEIGHT > 2
  330. STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false);
  331. #endif
  332. MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_advanced_pause_resume_print);
  333. MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_PURGE, lcd_advanced_pause_extrude_more);
  334. END_MENU();
  335. }
  336. //
  337. // ADVANCED_PAUSE_FEATURE message screens
  338. //
  339. void _lcd_advanced_pause_message(PGM_P const msg1, PGM_P const msg2=NULL, PGM_P const msg3=NULL) {
  340. START_SCREEN();
  341. STATIC_ITEM_P(advanced_pause_header(), true, true);
  342. STATIC_ITEM_P(msg1);
  343. if (msg2) STATIC_ITEM_P(msg2);
  344. if (msg3) STATIC_ITEM_P(msg3);
  345. if ((!!msg2) + (!!msg3) + 2 < LCD_HEIGHT - 1) STATIC_ITEM(" ");
  346. HOTEND_STATUS_ITEM();
  347. END_SCREEN();
  348. }
  349. void lcd_advanced_pause_init_message() {
  350. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INIT_1)
  351. #ifdef MSG_FILAMENT_CHANGE_INIT_2
  352. , PSTR(MSG_FILAMENT_CHANGE_INIT_2)
  353. #ifdef MSG_FILAMENT_CHANGE_INIT_3
  354. , PSTR(MSG_FILAMENT_CHANGE_INIT_3)
  355. #endif
  356. #endif
  357. );
  358. }
  359. void lcd_advanced_pause_unload_message() {
  360. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_UNLOAD_1)
  361. #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
  362. , PSTR(MSG_FILAMENT_CHANGE_UNLOAD_2)
  363. #ifdef MSG_FILAMENT_CHANGE_UNLOAD_3
  364. , PSTR(MSG_FILAMENT_CHANGE_UNLOAD_3)
  365. #endif
  366. #endif
  367. );
  368. }
  369. void lcd_advanced_pause_heating_message() {
  370. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEATING_1)
  371. #ifdef MSG_FILAMENT_CHANGE_HEATING_2
  372. , PSTR(MSG_FILAMENT_CHANGE_HEATING_2)
  373. #ifdef MSG_FILAMENT_CHANGE_HEATING_3
  374. , PSTR(MSG_FILAMENT_CHANGE_HEATING_3)
  375. #endif
  376. #endif
  377. );
  378. }
  379. void lcd_advanced_pause_heat_message() {
  380. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEAT_1)
  381. #ifdef MSG_FILAMENT_CHANGE_HEAT_2
  382. , PSTR(MSG_FILAMENT_CHANGE_HEAT_2)
  383. #ifdef MSG_FILAMENT_CHANGE_HEAT_3
  384. , PSTR(MSG_FILAMENT_CHANGE_HEAT_3)
  385. #endif
  386. #endif
  387. );
  388. }
  389. void lcd_advanced_pause_insert_message() {
  390. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INSERT_1)
  391. #ifdef MSG_FILAMENT_CHANGE_INSERT_2
  392. , PSTR(MSG_FILAMENT_CHANGE_INSERT_2)
  393. #ifdef MSG_FILAMENT_CHANGE_INSERT_3
  394. , PSTR(MSG_FILAMENT_CHANGE_INSERT_3)
  395. #endif
  396. #endif
  397. );
  398. }
  399. void lcd_advanced_pause_load_message() {
  400. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_LOAD_1)
  401. #ifdef MSG_FILAMENT_CHANGE_LOAD_2
  402. , PSTR(MSG_FILAMENT_CHANGE_LOAD_2)
  403. #ifdef MSG_FILAMENT_CHANGE_LOAD_3
  404. , PSTR(MSG_FILAMENT_CHANGE_LOAD_3)
  405. #endif
  406. #endif
  407. );
  408. }
  409. void lcd_advanced_pause_waiting_message() {
  410. _lcd_advanced_pause_message(PSTR(MSG_ADVANCED_PAUSE_WAITING_1)
  411. #ifdef MSG_ADVANCED_PAUSE_WAITING_2
  412. , PSTR(MSG_ADVANCED_PAUSE_WAITING_2)
  413. #ifdef MSG_ADVANCED_PAUSE_WAITING_3
  414. , PSTR(MSG_ADVANCED_PAUSE_WAITING_3)
  415. #endif
  416. #endif
  417. );
  418. }
  419. void lcd_advanced_pause_resume_message() {
  420. _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_RESUME_1)
  421. #ifdef MSG_FILAMENT_CHANGE_RESUME_2
  422. , PSTR(MSG_FILAMENT_CHANGE_RESUME_2)
  423. #ifdef MSG_FILAMENT_CHANGE_RESUME_3
  424. , PSTR(MSG_FILAMENT_CHANGE_RESUME_3)
  425. #endif
  426. #endif
  427. );
  428. }
  429. void lcd_advanced_pause_purge_message() {
  430. _lcd_advanced_pause_message(
  431. #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
  432. PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_1)
  433. #ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_2
  434. , PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_2)
  435. #ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_3
  436. , PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_3)
  437. #endif
  438. #endif
  439. #else
  440. PSTR(MSG_FILAMENT_CHANGE_PURGE_1)
  441. #ifdef MSG_FILAMENT_CHANGE_PURGE_2
  442. , PSTR(MSG_FILAMENT_CHANGE_PURGE_2)
  443. #ifdef MSG_FILAMENT_CHANGE_PURGE_3
  444. , PSTR(MSG_FILAMENT_CHANGE_PURGE_3)
  445. #endif
  446. #endif
  447. #endif
  448. );
  449. }
  450. FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) {
  451. switch (message) {
  452. case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message;
  453. case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message;
  454. case ADVANCED_PAUSE_MESSAGE_WAITING: return lcd_advanced_pause_waiting_message;
  455. case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message;
  456. case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message;
  457. case ADVANCED_PAUSE_MESSAGE_PURGE: return lcd_advanced_pause_purge_message;
  458. case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message;
  459. case ADVANCED_PAUSE_MESSAGE_HEAT: return lcd_advanced_pause_heat_message;
  460. case ADVANCED_PAUSE_MESSAGE_HEATING: return lcd_advanced_pause_heating_message;
  461. case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR;
  462. return menu_advanced_pause_option;
  463. case ADVANCED_PAUSE_MESSAGE_STATUS:
  464. default: break;
  465. }
  466. return NULL;
  467. }
  468. void lcd_advanced_pause_show_message(
  469. const AdvancedPauseMessage message,
  470. const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_SAME*/,
  471. const uint8_t extruder/*=active_extruder*/
  472. ) {
  473. if (mode != ADVANCED_PAUSE_MODE_SAME) advanced_pause_mode = mode;
  474. hotend_status_extruder = extruder;
  475. const screenFunc_t next_screen = ap_message_screen(message);
  476. if (next_screen) {
  477. ui.defer_status_screen(true);
  478. ui.goto_screen(next_screen);
  479. }
  480. else
  481. ui.return_to_status();
  482. }
  483. #endif // HAS_LCD_MENU && ADVANCED_PAUSE_FEATURE