Minor cleanup w/r/t LEDs

This commit is contained in:
Scott Lahteine
2020-08-23 23:57:51 -05:00
parent 4b124352ef
commit c488070859
16 changed files with 34 additions and 43 deletions

View File

@@ -53,9 +53,9 @@ Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIX
#endif
void Marlin_NeoPixel::set_color(const uint32_t color) {
if (get_neo_index() >= 0) {
set_pixel_color(get_neo_index(), color);
set_neo_index(-1);
if (neoindex >= 0) {
set_pixel_color(neoindex, color);
neoindex = -1;
}
else {
for (uint16_t i = 0; i < pixels(); ++i) {
@@ -78,18 +78,17 @@ void Marlin_NeoPixel::set_color_startup(const uint32_t color) {
}
void Marlin_NeoPixel::init() {
set_neo_index(-1); // -1 .. NEOPIXEL_PIXELS-1 range
neoindex = -1; // -1 .. NEOPIXEL_PIXELS-1 range
set_brightness(NEOPIXEL_BRIGHTNESS); // 0 .. 255 range
begin();
show(); // initialize to all off
#if ENABLED(NEOPIXEL_STARTUP_TEST)
set_color_startup(adaneo1.Color(255, 0, 0, 0)); // red
safe_delay(1000);
safe_delay(500);
set_color_startup(adaneo1.Color(0, 255, 0, 0)); // green
safe_delay(1000);
safe_delay(500);
set_color_startup(adaneo1.Color(0, 0, 255, 0)); // blue
safe_delay(1000);
#endif
#ifdef NEOPIXEL_BKGD_LED_INDEX