|
@@ -35,6 +35,7 @@
|
35
|
35
|
#endif
|
36
|
36
|
|
37
|
37
|
Marlin_NeoPixel neo;
|
|
38
|
+int8_t Marlin_NeoPixel::neoindex;
|
38
|
39
|
|
39
|
40
|
Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800)
|
40
|
41
|
#if MULTIPLE_NEOPIXEL_TYPES
|
|
@@ -52,14 +53,20 @@ Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIX
|
52
|
53
|
#endif
|
53
|
54
|
|
54
|
55
|
void Marlin_NeoPixel::set_color(const uint32_t color) {
|
55
|
|
- for (uint16_t i = 0; i < pixels(); ++i) {
|
56
|
|
- #ifdef NEOPIXEL_BKGD_LED_INDEX
|
57
|
|
- if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
|
58
|
|
- set_color_background();
|
59
|
|
- continue;
|
60
|
|
- }
|
61
|
|
- #endif
|
62
|
|
- set_pixel_color(i, color);
|
|
56
|
+ if (get_neo_index() < 0) {
|
|
57
|
+ set_pixel_color(get_neo_index(), color);
|
|
58
|
+ set_neo_index(-1);
|
|
59
|
+ }
|
|
60
|
+ else {
|
|
61
|
+ for (uint16_t i = 0; i < pixels(); ++i) {
|
|
62
|
+ #ifdef NEOPIXEL_BKGD_LED_INDEX
|
|
63
|
+ if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
|
|
64
|
+ set_color_background();
|
|
65
|
+ continue;
|
|
66
|
+ }
|
|
67
|
+ #endif
|
|
68
|
+ set_pixel_color(i, color);
|
|
69
|
+ }
|
63
|
70
|
}
|
64
|
71
|
show();
|
65
|
72
|
}
|
|
@@ -71,7 +78,8 @@ void Marlin_NeoPixel::set_color_startup(const uint32_t color) {
|
71
|
78
|
}
|
72
|
79
|
|
73
|
80
|
void Marlin_NeoPixel::init() {
|
74
|
|
- set_brightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
|
|
81
|
+ set_neo_index(-1); // -1 .. NEOPIXEL_PIXELS-1 range
|
|
82
|
+ set_brightness(NEOPIXEL_BRIGHTNESS); // 0 .. 255 range
|
75
|
83
|
begin();
|
76
|
84
|
show(); // initialize to all off
|
77
|
85
|
|