|
|
@ -37,11 +37,29 @@
|
|
|
|
Adafruit_NeoPixel pixels(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800);
|
|
|
|
Adafruit_NeoPixel pixels(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800);
|
|
|
|
|
|
|
|
|
|
|
|
void set_neopixel_color(const uint32_t color) {
|
|
|
|
void set_neopixel_color(const uint32_t color) {
|
|
|
|
|
|
|
|
for (uint16_t i = 0; i < pixels.numPixels(); ++i) {
|
|
|
|
|
|
|
|
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
|
|
|
|
|
|
|
if (NEOPIXEL_BKGD_LED_INDEX == i) i++;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pixels.setPixelColor(i, color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pixels.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void set_neopixel_color_startup(const uint32_t color) {
|
|
|
|
for (uint16_t i = 0; i < pixels.numPixels(); ++i)
|
|
|
|
for (uint16_t i = 0; i < pixels.numPixels(); ++i)
|
|
|
|
pixels.setPixelColor(i, color);
|
|
|
|
pixels.setPixelColor(i, color);
|
|
|
|
pixels.show();
|
|
|
|
pixels.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
|
|
|
|
|
|
|
void set_neopixel_color_background() {
|
|
|
|
|
|
|
|
uint8_t background_color[4] = NEOPIXEL_BKGD_COLOR;
|
|
|
|
|
|
|
|
pixels.setPixelColor(NEOPIXEL_BKGD_LED_INDEX, pixels.Color(background_color[0], background_color[1], background_color[2], background_color[3]));
|
|
|
|
|
|
|
|
pixels.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void setup_neopixel() {
|
|
|
|
void setup_neopixel() {
|
|
|
|
SET_OUTPUT(NEOPIXEL_PIN);
|
|
|
|
SET_OUTPUT(NEOPIXEL_PIN);
|
|
|
|
pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
|
|
|
|
pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
|
|
|
@ -50,14 +68,18 @@ void setup_neopixel() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(NEOPIXEL_STARTUP_TEST)
|
|
|
|
#if ENABLED(NEOPIXEL_STARTUP_TEST)
|
|
|
|
safe_delay(1000);
|
|
|
|
safe_delay(1000);
|
|
|
|
set_neopixel_color(pixels.Color(255, 0, 0, 0)); // red
|
|
|
|
set_neopixel_color_startup(pixels.Color(255, 0, 0, 0)); // red
|
|
|
|
safe_delay(1000);
|
|
|
|
safe_delay(1000);
|
|
|
|
set_neopixel_color(pixels.Color(0, 255, 0, 0)); // green
|
|
|
|
set_neopixel_color_startup(pixels.Color(0, 255, 0, 0)); // green
|
|
|
|
safe_delay(1000);
|
|
|
|
safe_delay(1000);
|
|
|
|
set_neopixel_color(pixels.Color(0, 0, 255, 0)); // blue
|
|
|
|
set_neopixel_color_startup(pixels.Color(0, 0, 255, 0)); // blue
|
|
|
|
safe_delay(1000);
|
|
|
|
safe_delay(1000);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
|
|
|
|
|
|
|
set_neopixel_color_background();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LED_USER_PRESET_STARTUP)
|
|
|
|
#if ENABLED(LED_USER_PRESET_STARTUP)
|
|
|
|
set_neopixel_color(pixels.Color(LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE));
|
|
|
|
set_neopixel_color(pixels.Color(LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, LED_USER_PRESET_WHITE));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|