Marlin: NeoPixels with NEOPIXEL_STARTUP_TEST causes bootloop

Created on 20 Oct 2017  路  19Comments  路  Source: MarlinFirmware/Marlin

Bug Report

  • Description: Using NEOPIXEL_LED (type NEO_GRB) with NEOPIXEL_STARTUP_TEST enabled, the printer bootloops. With NEOPIXEL_STARTUP_TEST disabled the printer boots and the colors work (including blue)
  • Expected behaviour: LEDs should cycle colors on printer startup
  • Actual behaviour: LEDs displays red, green and then the firmware reboots, nothing on the LCD. It never shows blue color.
  • Steps to reproduce:

    • Enable NEOPIXEL_LED

    • Enable NEOPIXEL_TYPE NEO_GRB

    • Enable NEOPIXEL_STARTUP_TEST

Configuration.zip

Not getting green at the end btw. Does Marlin look for some specific end gcode?

*Marlin 1.1.6 stable

Most helpful comment

I've changed this to what it should have been:

void setup_neopixel() {
  pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
  pixels.begin();
  pixels.show(); // initialize to all off

  #if ENABLED(NEOPIXEL_STARTUP_TEST)
    safe_delay(2000);
    neopixel_set_led_color(255, 0, 0, 0, 255);  // red
    safe_delay(2000);
    neopixel_set_led_color(0, 255, 0, 0, 255);  // green
    safe_delay(2000);
    neopixel_set_led_color(0, 0, 255, 0, 255);  // blue
    safe_delay(2000);
  #endif
  neopixel_set_led_color(0, 0, 0, 255, 255);    // white
}

All 19 comments

Without having looked at the actual code:
Watchdog is already active but not refreshed in your long lasting (>3s) procedure.

I had the same.
I did this to mine (in neopixel.cpp) to make it work.

void setup_neopixel() {
  pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
  pixels.begin();
  pixels.show(); // initialize to all off

  #if ENABLED(NEOPIXEL_STARTUP_TEST)
    delay(2000);
    #if ENABLED(USE_WATCHDOG)
      watchdog_reset();
    #endif
    neopixel_set_led_color(255, 0, 0, 0, 255);  // red
    delay(2000);
    #if ENABLED(USE_WATCHDOG)
      watchdog_reset();
    #endif
    neopixel_set_led_color(0, 255, 0, 0, 255);  // green
    delay(2000);
    #if ENABLED(USE_WATCHDOG)
      watchdog_reset();
    #endif
    neopixel_set_led_color(0, 0, 255, 0, 255);  // blue
    delay(2000);
    #if ENABLED(USE_WATCHDOG)
      watchdog_reset();
    #endif
  #endif
  neopixel_set_led_color(0, 0, 0, 255, 255);    // white
}

Someone promised this.
https://www.youtube.com/watch?v=YxvBPH4sArQ from about 1:46
Do you remember? :-(

Yup. Lol

I've changed this to what it should have been:

void setup_neopixel() {
  pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
  pixels.begin();
  pixels.show(); // initialize to all off

  #if ENABLED(NEOPIXEL_STARTUP_TEST)
    safe_delay(2000);
    neopixel_set_led_color(255, 0, 0, 0, 255);  // red
    safe_delay(2000);
    neopixel_set_led_color(0, 255, 0, 0, 255);  // green
    safe_delay(2000);
    neopixel_set_led_color(0, 0, 255, 0, 255);  // blue
    safe_delay(2000);
  #endif
  neopixel_set_led_color(0, 0, 0, 255, 255);    // white
}

I can confirm this happens for me too. LCD Display stays empty, LED cycles through green, red, off etc.

@Tannoo
Where I've to add this?

In neopixel.cpp.

It's not an addition... it's a change.

In the funtion setup_neopixel(), change all the delay(2000)'s to safe_delay(2000).

That will insure all background processes keep processing.

Hmm...and this file can be found where?

Can't find the function in Marlin or NeoPixel Library.

Marlin/src/feature/leds/neopixel.cpp

Ahh okay this is 2.x. However search function of github does not work properly and I haven't been able to find the code.

Code for 1.1.x can be found in Marlin_main.cpp

Works great, are you going to push this to the repo? If you don't mind I can do this.

I can't push. I'm not that important. Lol

I can nudge.

gj :) 馃憤

@Tannoo
ssafe_delay?

Isn't it "safe_delay"?

Did I have a type-o?

I guess so.

Issue could be closed I think. There are PR fixing this.

Was this page helpful?
0 / 5 - 0 ratings