Neopixel Configuration

Basic Information:

Ender5 Plus
Octopus v1.1

Can we discuss configuration of the Neopixel in a little depth.
I have it declared in printer config with the pin # and the count= sections and the initial colors all set to 1. And that works they all light up.
I have a simple setup with one strip of 30 lights. 10 left 10 right and 10 front of the bed. I would like to be able to index those sets of ten separately. Mainly keep the ten front lights white to light the bed and the left and right sets to show progress or any other effects my mind might dream up. But I haven’t been able to find any in depth info on configuration yet

Any advice would be most appreciated.

Check out this post, sounds like what you want?

NeoPixel Led as Progress Bar?

I have a neopixel on my SBC and I use it to display temp gradient of the SBC.

@Wes68 You can use SET_LED INDEX parameter.
@jjarosz Neopixel Led as Progress Bar doesn’t support subsections of the same led.

1 Like

I do not use LEDs but AFAIK grouping within one string is not supported.
There was a PR which seem to have pointed in this direction but it was not accepted:

You might be able to work around with a macro, something like

gcode:
    {% for i in range(10) %}
    SET_LED LED=<config_name> RED=<value> GREEN=<value> BLUE=<value> WHITE=<value> INDEX={i} TRANSMIT=1 SYNC=0
    {% endfor %}

Untested but should set the first 10 LEDs. Do the same for 11 to 20 and 21 to 30

1 Like

IIRC the LED chip numbering starts with 1, so the range construct would need something like

# 1 to 10
{% for i in range(1,11) %}
# 11 to 20
{% for i in range(11,21) %}
# 21 to 30
{% for i in range(21,31) %} 
1 Like

So I got this little snippet of code to work in separating my led strip into three sections of 10. Now I just need to learn some more jinja2 and start making my individual sections “DO STUFF” for me.

{% for i in range(1,11) %}
SET_LED LED=OctoEnder RED=0 GREEN=0 BLUE=1 WHITE=0 INDEX={i} TRANSMIT=1 SYNC=0
{% endfor %}

{% for i in range(11,21) %}
      SET_LED LED=OctoEnder RED=0 GREEN=1 BLUE=0 WHITE=0 INDEX={i} TRANSMIT=1 SYNC=0
{% endfor %}

{% for i in range(21,31) %}
      SET_LED LED=OctoEnder RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX={i} TRANSMIT=1 SYNC=0
{% endfor %}
1 Like

[gcode_macro L150]
#Description: Macro to control 30 String Neopixels.
#10 Left, 10 Center, 10 Right of printer bed
#Keeping center LEDs as white/offwhite bed light
gcode:
{% set x = params.LED | default(octoender) %}
{% set mode = params.MODE %}

SET_LED_TEMPLATE LED={led} TEMPLATE={ ‘led_’ ~ mode }

[display_template led_boot]
text:
{% for il in range[1,10] %}
{% for ic in range(11,21) %}
{% for ir in range(21,31) %}
SET_LED LED={x} RED=1 GREEN=0 BLUE=0 INDEX={il+1} TRANSMIT=1 SYNC=0
SET_LED LED={x} RED=1 GREEN=0 BLUE=0 INDEX={ic+1} TRANSMIT=1 SYNC=0
SET_LED LED={x} RED=1 GREEN=0 BLUE=0 INDEX={ir+1} TRANSMIT=1 SYNC=0
{% endfor %}
{% endfor %}
{% endfor %}
++++++++++++++++++++
I cant figure out what I’m doing wrong here. when I run my macro L150 LED=OctoEnder MODE=boot I expect each section of LEDs (Left, Right, and Center) to change from white to red. just as a test.
It works until I try to incorporate the DISPLAY_TEMPLATE section and the SET_LED_TEMPLATE section. Once I add that I get the following in console:

5:48 PM
l150 LED=OctoEnder MODE=boot

5:48 PM
Unknown LED ‘=’

5:48 PM
Unknown LED ‘=’

HELP please someone who knows this macro stuff…

the code was properly indented before I copied and pasted it…