Browse Source

Move LED Menu to its own file

Scott Lahteine 6 years ago
parent
commit
6896847210
2 changed files with 83 additions and 66 deletions
  1. 0
    66
      Marlin/src/lcd/menu/menu.cpp
  2. 83
    0
      Marlin/src/lcd/menu/menu_led.cpp

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

43
   #include "../../sd/cardreader.h"
43
   #include "../../sd/cardreader.h"
44
 #endif
44
 #endif
45
 
45
 
46
-#if ENABLED(ADVANCED_PAUSE_FEATURE)
47
-  #include "../../feature/pause.h"
48
-#endif
49
-
50
 #if HAS_LEVELING
46
 #if HAS_LEVELING
51
   #include "../../feature/bedlevel/bedlevel.h"
47
   #include "../../feature/bedlevel/bedlevel.h"
52
 #endif
48
 #endif
53
 
49
 
54
-#if ENABLED(LED_CONTROL_MENU)
55
-  #include "../../feature/leds/leds.h"
56
-#endif
57
-
58
 ////////////////////////////////////////////
50
 ////////////////////////////////////////////
59
 ///////////// Global Variables /////////////
51
 ///////////// Global Variables /////////////
60
 ////////////////////////////////////////////
52
 ////////////////////////////////////////////
764
 
756
 
765
 #endif // SDSUPPORT
757
 #endif // SDSUPPORT
766
 
758
 
767
-/**
768
- *
769
- * LED Menu
770
- *
771
- */
772
-
773
-#if ENABLED(LED_CONTROL_MENU)
774
-
775
-  #if ENABLED(LED_COLOR_PRESETS)
776
-
777
-    void menu_led_presets() {
778
-      START_MENU();
779
-      #if LCD_HEIGHT > 2
780
-        STATIC_ITEM(MSG_LED_PRESETS, true, true);
781
-      #endif
782
-      MENU_BACK(MSG_LED_CONTROL);
783
-      MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white);
784
-      MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red);
785
-      MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange);
786
-      MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow);
787
-      MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green);
788
-      MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue);
789
-      MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo);
790
-      MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet);
791
-      END_MENU();
792
-    }
793
-  #endif // LED_COLOR_PRESETS
794
-
795
-  void menu_led_custom() {
796
-    START_MENU();
797
-    MENU_BACK(MSG_LED_CONTROL);
798
-    MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
799
-    MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
800
-    MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true);
801
-    #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED)
802
-      MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
803
-      #if ENABLED(NEOPIXEL_LED)
804
-        MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
805
-      #endif
806
-    #endif
807
-    END_MENU();
808
-  }
809
-
810
-  void menu_led() {
811
-    START_MENU();
812
-    MENU_BACK(MSG_MAIN);
813
-    bool led_on = leds.lights_on;
814
-    MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle);
815
-    MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
816
-    #if ENABLED(LED_COLOR_PRESETS)
817
-      MENU_ITEM(submenu, MSG_LED_PRESETS, menu_led_presets);
818
-    #endif
819
-    MENU_ITEM(submenu, MSG_CUSTOM_LEDS, menu_led_custom);
820
-    END_MENU();
821
-  }
822
-
823
-#endif // LED_CONTROL_MENU
824
-
825
 #endif // ULTIPANEL
759
 #endif // ULTIPANEL

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

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
+// LED Menu
25
+//
26
+
27
+#include "../../inc/MarlinConfigPre.h"
28
+
29
+#if HAS_LCD_MENU && ENABLED(LED_CONTROL_MENU)
30
+
31
+#include "menu.h"
32
+#include "../../feature/leds/leds.h"
33
+
34
+#if ENABLED(LED_COLOR_PRESETS)
35
+
36
+  void menu_led_presets() {
37
+    START_MENU();
38
+    #if LCD_HEIGHT > 2
39
+      STATIC_ITEM(MSG_LED_PRESETS, true, true);
40
+    #endif
41
+    MENU_BACK(MSG_LED_CONTROL);
42
+    MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white);
43
+    MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red);
44
+    MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange);
45
+    MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow);
46
+    MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green);
47
+    MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue);
48
+    MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo);
49
+    MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet);
50
+    END_MENU();
51
+  }
52
+
53
+#endif
54
+
55
+void menu_led_custom() {
56
+  START_MENU();
57
+  MENU_BACK(MSG_LED_CONTROL);
58
+  MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
59
+  MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
60
+  MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true);
61
+  #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED)
62
+    MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
63
+    #if ENABLED(NEOPIXEL_LED)
64
+      MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
65
+    #endif
66
+  #endif
67
+  END_MENU();
68
+}
69
+
70
+void menu_led() {
71
+  START_MENU();
72
+  MENU_BACK(MSG_MAIN);
73
+  bool led_on = leds.lights_on;
74
+  MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle);
75
+  MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
76
+  #if ENABLED(LED_COLOR_PRESETS)
77
+    MENU_ITEM(submenu, MSG_LED_PRESETS, menu_led_presets);
78
+  #endif
79
+  MENU_ITEM(submenu, MSG_CUSTOM_LEDS, menu_led_custom);
80
+  END_MENU();
81
+}
82
+
83
+#endif // HAS_LCD_MENU && LED_CONTROL_MENU

Loading…
Cancel
Save