Browse Source

Move Custom User Menu to its own file

Scott Lahteine 6 years ago
parent
commit
0161d3f733

+ 0
- 57
Marlin/src/lcd/menu/menu.cpp View File

@@ -388,63 +388,6 @@ void line_to_z(const float &z) {
388 388
   line_to_current_z();
389 389
 }
390 390
 
391
-#if ENABLED(CUSTOM_USER_MENUS)
392
-
393
-  #ifdef USER_SCRIPT_DONE
394
-    #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE
395
-  #else
396
-    #define _DONE_SCRIPT ""
397
-  #endif
398
-
399
-  void _lcd_user_gcode(PGM_P const cmd) {
400
-    enqueue_and_echo_commands_P(cmd);
401
-    #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
402
-      lcd_completion_feedback();
403
-    #endif
404
-    #if ENABLED(USER_SCRIPT_RETURN)
405
-      lcd_return_to_status();
406
-    #endif
407
-  }
408
-
409
-  #if defined(USER_DESC_1) && defined(USER_GCODE_1)
410
-    void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); }
411
-  #endif
412
-  #if defined(USER_DESC_2) && defined(USER_GCODE_2)
413
-    void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); }
414
-  #endif
415
-  #if defined(USER_DESC_3) && defined(USER_GCODE_3)
416
-    void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); }
417
-  #endif
418
-  #if defined(USER_DESC_4) && defined(USER_GCODE_4)
419
-    void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); }
420
-  #endif
421
-  #if defined(USER_DESC_5) && defined(USER_GCODE_5)
422
-    void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); }
423
-  #endif
424
-
425
-  void _menu_user() {
426
-    START_MENU();
427
-    MENU_BACK(MSG_MAIN);
428
-    #if defined(USER_DESC_1) && defined(USER_GCODE_1)
429
-      MENU_ITEM(function, USER_DESC_1, lcd_user_gcode_1);
430
-    #endif
431
-    #if defined(USER_DESC_2) && defined(USER_GCODE_2)
432
-      MENU_ITEM(function, USER_DESC_2, lcd_user_gcode_2);
433
-    #endif
434
-    #if defined(USER_DESC_3) && defined(USER_GCODE_3)
435
-      MENU_ITEM(function, USER_DESC_3, lcd_user_gcode_3);
436
-    #endif
437
-    #if defined(USER_DESC_4) && defined(USER_GCODE_4)
438
-      MENU_ITEM(function, USER_DESC_4, lcd_user_gcode_4);
439
-    #endif
440
-    #if defined(USER_DESC_5) && defined(USER_GCODE_5)
441
-      MENU_ITEM(function, USER_DESC_5, lcd_user_gcode_5);
442
-    #endif
443
-    END_MENU();
444
-  }
445
-
446
-#endif
447
-
448 391
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
449 392
 
450 393
   void lcd_babystep_zoffset() {

+ 87
- 0
Marlin/src/lcd/menu/menu_custom.cpp View File

@@ -0,0 +1,87 @@
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
+// Custom User Menu
25
+//
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#if HAS_LCD_MENU && ENABLED(CUSTOM_USER_MENUS)
30
+
31
+#include "menu.h"
32
+#include "../../gcode/queue.h"
33
+
34
+#ifdef USER_SCRIPT_DONE
35
+  #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE
36
+#else
37
+  #define _DONE_SCRIPT ""
38
+#endif
39
+
40
+void _lcd_user_gcode(PGM_P const cmd) {
41
+  enqueue_and_echo_commands_P(cmd);
42
+  #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
43
+    lcd_completion_feedback();
44
+  #endif
45
+  #if ENABLED(USER_SCRIPT_RETURN)
46
+    lcd_return_to_status();
47
+  #endif
48
+}
49
+
50
+#if defined(USER_DESC_1) && defined(USER_GCODE_1)
51
+  void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); }
52
+#endif
53
+#if defined(USER_DESC_2) && defined(USER_GCODE_2)
54
+  void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); }
55
+#endif
56
+#if defined(USER_DESC_3) && defined(USER_GCODE_3)
57
+  void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); }
58
+#endif
59
+#if defined(USER_DESC_4) && defined(USER_GCODE_4)
60
+  void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); }
61
+#endif
62
+#if defined(USER_DESC_5) && defined(USER_GCODE_5)
63
+  void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); }
64
+#endif
65
+
66
+void menu_user() {
67
+  START_MENU();
68
+  MENU_BACK(MSG_MAIN);
69
+  #if defined(USER_DESC_1) && defined(USER_GCODE_1)
70
+    MENU_ITEM(function, USER_DESC_1, lcd_user_gcode_1);
71
+  #endif
72
+  #if defined(USER_DESC_2) && defined(USER_GCODE_2)
73
+    MENU_ITEM(function, USER_DESC_2, lcd_user_gcode_2);
74
+  #endif
75
+  #if defined(USER_DESC_3) && defined(USER_GCODE_3)
76
+    MENU_ITEM(function, USER_DESC_3, lcd_user_gcode_3);
77
+  #endif
78
+  #if defined(USER_DESC_4) && defined(USER_GCODE_4)
79
+    MENU_ITEM(function, USER_DESC_4, lcd_user_gcode_4);
80
+  #endif
81
+  #if defined(USER_DESC_5) && defined(USER_GCODE_5)
82
+    MENU_ITEM(function, USER_DESC_5, lcd_user_gcode_5);
83
+  #endif
84
+  END_MENU();
85
+}
86
+
87
+#endif // HAS_LCD_MENU && CUSTOM_USER_MENUS

+ 2
- 2
Marlin/src/lcd/menu/menu_main.cpp View File

@@ -75,7 +75,7 @@ void menu_tune();
75 75
 void menu_motion();
76 76
 void menu_temperature();
77 77
 void menu_configuration();
78
-void _menu_user();
78
+void menu_user();
79 79
 void menu_temp_e0_filament_change();
80 80
 void menu_change_filament();
81 81
 void menu_info();
@@ -120,7 +120,7 @@ void menu_main() {
120 120
   MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration);
121 121
 
122 122
   #if ENABLED(CUSTOM_USER_MENUS)
123
-    MENU_ITEM(submenu, MSG_USER_MENU, _menu_user);
123
+    MENU_ITEM(submenu, MSG_USER_MENU, menu_user);
124 124
   #endif
125 125
 
126 126
   #if ENABLED(ADVANCED_PAUSE_FEATURE)

Loading…
Cancel
Save