Browse Source

🧑‍💻 Add neo.set_background_color(rgbw)

Scott Lahteine 3 years ago
parent
commit
de8e436110
2 changed files with 6 additions and 5 deletions
  1. 4
    4
      Marlin/src/feature/leds/neopixel.cpp
  2. 2
    1
      Marlin/src/feature/leds/neopixel.h

+ 4
- 4
Marlin/src/feature/leds/neopixel.cpp View File

44
 
44
 
45
 #ifdef NEOPIXEL_BKGD_INDEX_FIRST
45
 #ifdef NEOPIXEL_BKGD_INDEX_FIRST
46
 
46
 
47
-  void Marlin_NeoPixel::set_background_color(uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
48
-    for  (int background_led = NEOPIXEL_BKGD_INDEX_FIRST; background_led <= NEOPIXEL_BKGD_INDEX_LAST; background_led++)
47
+  void Marlin_NeoPixel::set_background_color(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w) {
48
+    for (int background_led = NEOPIXEL_BKGD_INDEX_FIRST; background_led <= NEOPIXEL_BKGD_INDEX_LAST; background_led++)
49
       set_pixel_color(background_led, adaneo1.Color(r, g, b, w));
49
       set_pixel_color(background_led, adaneo1.Color(r, g, b, w));
50
   }
50
   }
51
 
51
 
52
   void Marlin_NeoPixel::reset_background_color() {
52
   void Marlin_NeoPixel::reset_background_color() {
53
     constexpr uint8_t background_color[4] = NEOPIXEL_BKGD_COLOR;
53
     constexpr uint8_t background_color[4] = NEOPIXEL_BKGD_COLOR;
54
-    set_background_color(background_color[0], background_color[1], background_color[2], background_color[3]);
54
+    set_background_color(background_color);
55
   }
55
   }
56
 
56
 
57
 #endif
57
 #endif
108
   set_color(adaneo1.Color
108
   set_color(adaneo1.Color
109
     TERN(LED_USER_PRESET_STARTUP,
109
     TERN(LED_USER_PRESET_STARTUP,
110
       (LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE),
110
       (LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE),
111
-      (0, 0, 0, 0))
111
+      (255, 255, 255, 255))
112
   );
112
   );
113
 }
113
 }
114
 
114
 

+ 2
- 1
Marlin/src/feature/leds/neopixel.h View File

88
   static void set_color(const uint32_t c);
88
   static void set_color(const uint32_t c);
89
 
89
 
90
   #ifdef NEOPIXEL_BKGD_INDEX_FIRST
90
   #ifdef NEOPIXEL_BKGD_INDEX_FIRST
91
-    static void set_background_color(uint8_t r, uint8_t g, uint8_t b, uint8_t w);
91
+    static void set_background_color(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w);
92
+    static void set_background_color(const uint8_t (&rgbw)[4]) { set_background_color(rgbw[0], rgbw[1], rgbw[2], rgbw[3]); }
92
     static void reset_background_color();
93
     static void reset_background_color();
93
   #endif
94
   #endif
94
 
95
 

Loading…
Cancel
Save