|
@@ -0,0 +1,166 @@
|
|
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
|
+//
|
|
24
|
+// Main Menu
|
|
25
|
+//
|
|
26
|
+
|
|
27
|
+#include "../../inc/MarlinConfigPre.h"
|
|
28
|
+
|
|
29
|
+#if HAS_LCD_MENU
|
|
30
|
+
|
|
31
|
+#include "menu.h"
|
|
32
|
+#include "../../module/temperature.h"
|
|
33
|
+
|
|
34
|
+#if ENABLED(SDSUPPORT)
|
|
35
|
+
|
|
36
|
+ #include "../../sd/cardreader.h"
|
|
37
|
+ #include "../../gcode/queue.h"
|
|
38
|
+ #include "../../module/printcounter.h"
|
|
39
|
+
|
|
40
|
+ void lcd_sdcard_pause() {
|
|
41
|
+ card.pauseSDPrint();
|
|
42
|
+ print_job_timer.pause();
|
|
43
|
+ #if ENABLED(PARK_HEAD_ON_PAUSE)
|
|
44
|
+ enqueue_and_echo_commands_P(PSTR("M125"));
|
|
45
|
+ #endif
|
|
46
|
+ lcd_reset_status();
|
|
47
|
+ }
|
|
48
|
+
|
|
49
|
+ void lcd_sdcard_resume() {
|
|
50
|
+ #if ENABLED(PARK_HEAD_ON_PAUSE)
|
|
51
|
+ enqueue_and_echo_commands_P(PSTR("M24"));
|
|
52
|
+ #else
|
|
53
|
+ card.startFileprint();
|
|
54
|
+ print_job_timer.start();
|
|
55
|
+ #endif
|
|
56
|
+ lcd_reset_status();
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ void lcd_sdcard_stop() {
|
|
60
|
+ wait_for_heatup = wait_for_user = false;
|
|
61
|
+ card.abort_sd_printing = true;
|
|
62
|
+ lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
|
|
63
|
+ lcd_return_to_status();
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ #if ENABLED(MENU_ADDAUTOSTART)
|
|
67
|
+
|
|
68
|
+ void lcd_autostart_sd() { card.beginautostart(); }
|
|
69
|
+
|
|
70
|
+ #endif
|
|
71
|
+
|
|
72
|
+#endif // SDSUPPORT
|
|
73
|
+
|
|
74
|
+void menu_tune();
|
|
75
|
+void menu_movement();
|
|
76
|
+void menu_temperature();
|
|
77
|
+void menu_configuration();
|
|
78
|
+void _menu_user();
|
|
79
|
+void menu_temp_e0_filament_change();
|
|
80
|
+void menu_change_filament();
|
|
81
|
+void menu_info();
|
|
82
|
+void menu_led();
|
|
83
|
+
|
|
84
|
+void menu_main() {
|
|
85
|
+ START_MENU();
|
|
86
|
+ MENU_BACK(MSG_WATCH);
|
|
87
|
+
|
|
88
|
+ #if ENABLED(SDSUPPORT)
|
|
89
|
+ if (card.cardOK) {
|
|
90
|
+ if (card.isFileOpen()) {
|
|
91
|
+ if (card.sdprinting)
|
|
92
|
+ MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
|
|
93
|
+ else
|
|
94
|
+ MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
|
|
95
|
+ MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
|
|
96
|
+ }
|
|
97
|
+ else {
|
|
98
|
+ MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
|
|
99
|
+ #if !PIN_EXISTS(SD_DETECT)
|
|
100
|
+ MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user
|
|
101
|
+ #endif
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+ else {
|
|
105
|
+ MENU_ITEM(submenu, MSG_NO_CARD, menu_sdcard);
|
|
106
|
+ #if !PIN_EXISTS(SD_DETECT)
|
|
107
|
+ MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
|
|
108
|
+ #endif
|
|
109
|
+ }
|
|
110
|
+ #endif // SDSUPPORT
|
|
111
|
+
|
|
112
|
+ const bool busy = printer_busy();
|
|
113
|
+ if (busy)
|
|
114
|
+ MENU_ITEM(submenu, MSG_TUNE, menu_tune);
|
|
115
|
+ else {
|
|
116
|
+ MENU_ITEM(submenu, MSG_MOTION, menu_movement);
|
|
117
|
+ MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
|
|
118
|
+ }
|
|
119
|
+
|
|
120
|
+ MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration);
|
|
121
|
+
|
|
122
|
+ #if ENABLED(CUSTOM_USER_MENUS)
|
|
123
|
+ MENU_ITEM(submenu, MSG_USER_MENU, _menu_user);
|
|
124
|
+ #endif
|
|
125
|
+
|
|
126
|
+ #if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
127
|
+ #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
|
128
|
+ if (thermalManager.targetHotEnoughToExtrude(active_extruder))
|
|
129
|
+ MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0"));
|
|
130
|
+ else
|
|
131
|
+ MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_temp_e0_filament_change);
|
|
132
|
+ #else
|
|
133
|
+ MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_change_filament);
|
|
134
|
+ #endif
|
|
135
|
+ #endif
|
|
136
|
+
|
|
137
|
+ #if ENABLED(LCD_INFO_MENU)
|
|
138
|
+ MENU_ITEM(submenu, MSG_INFO_MENU, menu_info);
|
|
139
|
+ #endif
|
|
140
|
+
|
|
141
|
+ #if ENABLED(LED_CONTROL_MENU)
|
|
142
|
+ MENU_ITEM(submenu, MSG_LED_CONTROL, menu_led);
|
|
143
|
+ #endif
|
|
144
|
+
|
|
145
|
+ //
|
|
146
|
+ // Switch power on/off
|
|
147
|
+ //
|
|
148
|
+ #if HAS_POWER_SWITCH
|
|
149
|
+ if (powersupply_on)
|
|
150
|
+ MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
|
|
151
|
+ else
|
|
152
|
+ MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
|
|
153
|
+ #endif
|
|
154
|
+
|
|
155
|
+ //
|
|
156
|
+ // Autostart
|
|
157
|
+ //
|
|
158
|
+ #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
|
159
|
+ if (!busy)
|
|
160
|
+ MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
|
|
161
|
+ #endif
|
|
162
|
+
|
|
163
|
+ END_MENU();
|
|
164
|
+}
|
|
165
|
+
|
|
166
|
+#endif // HAS_LCD_MENU
|