julianschill / klipper-led_effect

LED effects plugin for klipper
GNU General Public License v3.0
722 stars 120 forks source link

Question: Possibility to reverse the order of progress/heater effect? #103

Closed goeland86 closed 2 years ago

goeland86 commented 2 years ago

Hi,

First off, thank you for a wonderful project!

I am very happy with the result and the ease of use you've provided to make the LEDs super configurable, it's no small feat.

Here's a question because my brain just went derp and stuck the LEDs on backwards on my Ender3...

I have a long strip (interrupted with short wires) in this configuration:

1-----------15
               16
                |
               25

Now the 1-15 LEDs are mostly there to act as a lighting on the printbed for Obico to see something at night. My issue is the 16-25 leds that I want to use for progress are displaying it from top down, and I thought it would be more natural from bottom up...

Here's the relevant led-effects.cfg file I'm currently using:

[neopixel leds]
pin:                     PA8
chain_count:             25
color_order:             GRB
initial_RED:             0.1
initial_GREEN:           0.1
initial_BLUE:            0.1

[led_effect lights_on]
autostart:              true
frame_rate:             24
leds:
    neopixel:leds (1-15)
layers:
    static 1 0 top (1,1,1)

[led_effect heater_progress]
leds:
    neopixel:leds (16-25)
autostart:                          true
frame_rate:                         24
heater:                             heater_bed
layers:
    heater  50 0 add    (1,1,0),(1,0,0)
    static  0  0 top    (1,0,0)

[led_effect critical_error]
leds:
    neopixel:leds
layers:
    strobe         1  1.5   add        (1.0,  1.0, 1.0)
    breathing      2  0     difference (0.95, 0.0, 0.0)
    static         1  0     top        (1.0,  0.0, 0.0)
autostart:                             false
frame_rate:                            24
run_on_error:                          true

[led_effect progress_bar]
leds:
    neopixel:leds (16-25)
autostart:                          true
frame_rate:                         24
layers:
    progress  -1  0 add         ( 0, 0,   1),( 0, 0.1, 0.6)
    static     0  0 top         ( 0, 0, 0.1)

What's the proper way to reverse the order of the progress bar? Making the range (25-16) ?

julianschill commented 2 years ago

Thanks. To reverse it, just inverse the indexes of the leds like you already proposed: neopixel:leds (25-16)