julianschill / klipper-led_effect

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

Nozzle LEDs flickering if set to white + logo LED effect #215

Open bthubs opened 4 months ago

bthubs commented 4 months ago

I am currently using a Xol toolhead and wired the LED harness as per their instructions. It uses 1x WS2812B 5050 and 2 WS2812B 3535 (small RGB LED sequins). It works with your typical (static) stealthburner cfg. But since I am using LED effect, there is an issue such that if the logo LED has an LED effect and I set the nozzle LEDs to white, they begin flickering, But if both the nozzle and logo LEDs have an LED effect, they work just fine. I have made a few observations while troubleshooting. I've redid my harness like 5 times as I initially thought there was a loose wire touching something, but each time has been the same effect. Another thing I did notice is that if I set the framerate of the logo LED to something high, the white nozzle LEDs flicker faster, and if I set framerate lower like 2, it flickers slower. This only happens if nozzle LEDs are set to white (ie red=1 green=1 blue=1) . It does not flicker if I have a logo effect and set the nozzle to a single color (R/G/B), but the moment I introduce another color, it flickers. I've also tried virtual_leds as well as putting a 470ohm resistor and it still doesn't work. Both the 5050 LED and 3535 LEDs are GRB color order.

Maybe this is just a hardware issue (ie the small RGB sequins aren't compatible with LED effect?) but it doesn't make sense why nozzle + logo both with LED effect works fine, but nozzle with white and any logo effect doesn't work. I have since changed my cfg to only have white nozzle LEDs while printing, with a static logo LED but I'm hoping a brighter mind can figure this out.

Update (same day): My tests thus far were without any extruding. Now I am having the same issue when extruding while both nozzle and logo have an LED effect. I did recently switch to a LDO Nitehawk 36, perhaps this is the issue? I never tried this LED harness when I had the EBB36 though so I have no point of reference here.

[neopixel sb_leds]
pin: nhk:gpio7
#   The pin connected to the neopixel. This parameter must be provided.
chain_count: 3
#   The number of Neopixel chips that are "daisy chained" to the
#   provided pin. The default is 1 (which indicates only a single
#   Neopixel is connected to the pin).
color_order: GRB
#   Set the pixel order required by the LED hardware. Options are GRB,
#   RGB, GRBW, or RGBW. The default is GRB.
initial_RED: 0
initial_GREEN: 0
initial_BLUE: 0
#   Sets the initial LED color of the Neopixel. Each value should be
#   between 0.0 and 1.0. The WHITE option is only available on RGBW
#   LEDs. The default for each color is 0.#

[virtual_leds nozzle_leds]
leds: neopixel:sb_leds (2,3)

[virtual_leds logo_leds]
leds: neopixel:sb_leds (1)

##########################
# LED Effects Animations #
##########################

##################
## logo effects ##
##################

[led_effect sb_logo_busy]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (1.0, 0.0, 0.0)

[led_effect sb_logo_cleaning]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.0, 0.02, 0.5)

[led_effect sb_logo_calibrating_z]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.0, 0.0, 0.35)

[led_effect sb_logo_heating]
leds:
    virtual_leds:logo_leds
autostart:                          false
frame_rate:                         24
layers:
     breathing  3 1 top (1, 0.18, 0.0)

[led_effect sb_logo_cooling]
leds:
    virtual_leds:logo_leds
autostart:                          false
frame_rate:                         24
layers:
     breathing  3 1 top (0.0, 0.0, 1.0)

[led_effect sb_logo_homing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.0, 0.6, 0.2)

[led_effect sb_logo_leveling]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.5, 0.1, 0.4)

[led_effect sb_logo_meshing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.2, 1.0, 0.0)

[led_effect sb_logo_printing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    static  0 0 top (0, 0, 1)

[led_effect sb_logo_standby]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.01, 0.01, 0.01)

[led_effect sb_logo_part_ready]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:logo_leds
layers:
    breathing  3 1 top (0.0, 1.0, 0.0)

####################
## nozzle effects ##
####################

[led_effect sb_nozzle_heating]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (1.0, 0.18, 0.0)

[led_effect sb_nozzle_cooling]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.0, 0.0, 1.0)

[led_effect sb_nozzle_standby]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.6, 0.0, 0.0)

[led_effect sb_nozzle_part_ready]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.6, 1.0, 0.0)

[led_effect sb_nozzle_leveling]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.5, 0.1, 0.4)

[led_effect sb_nozzle_homing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.0, 0.6, 0.2)

[led_effect sb_nozzle_cleaning]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.0, 0.02, 0.5)

[led_effect sb_nozzle_meshing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.2, 1.0, 0.0)

[led_effect sb_nozzle_calibrating_z]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (0.0, 0.0, 0.35)

[led_effect sb_nozzle_busy]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    breathing  3 1 top (1.0, 0.0, 0.0)

#####################
## all led effects ##
#####################

[led_effect sb_critical_error]
leds:
    neopixel:sb_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 rainbow]
leds:
    neopixel:sb_leds
autostart:                          true
frame_rate:                         24
layers:
    gradient  0.3  1 add (0.3, 0.0, 0.0),(0.0, 0.3, 0.0),(0.0, 0.0, 0.3)

#######################
# LED Effects Statics #
#######################

[led_effect set_nozzle_leds]
leds:
    virtual_leds:nozzle_leds
autostart:                          false
frame_rate:                         1
layers:
    static         0  0     top        (1.0, 1.0, 1.0)

[led_effect set_nozzle_leds_off] #added this for testing
leds:
    virtual_leds:nozzle_leds
autostart:                          false
frame_rate:                         1
layers:
    static         0  0     top        (0, 0, 0)

[led_effect set_logo_leds]
leds:
    virtual_leds:logo_leds
autostart:                          false
frame_rate:                         1
layers:
    static         0  0     top        (1.0, 1.0, 1.0)

[led_effect sb_nozzle_printing]
autostart:              false
frame_rate:             24
leds:
    virtual_leds:nozzle_leds
layers:
    static  0 0 top (1, 1, 1)

##############
# The Macros #
##############

[gcode_macro set_logo_leds_off]
gcode:
    SET_LED_EFFECT EFFECT=set_logo_leds STOP=1

[gcode_macro set_logo_leds_on]
gcode:
    SET_LED_EFFECT EFFECT=set_logo_leds

[gcode_macro set_nozzle_leds_on]
gcode:
    SET_LED_EFFECT EFFECT=set_nozzle_leds

[gcode_macro set_nozzle_leds_off]
gcode:
    SET_LED_EFFECT EFFECT=set_nozzle_leds STOP=1

[gcode_macro status_on]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=set_logo_leds
    SET_LED_EFFECT EFFECT=set_nozzle_leds

[gcode_macro status_off]
gcode:
    STOP_LED_EFFECTS

[gcode_macro status_ready]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=rainbow

[gcode_macro status_part_ready]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_nozzle_part_ready
    SET_LED_EFFECT EFFECT=sb_logo_part_ready

[gcode_macro status_busy]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_busy

[gcode_macro status_heating]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_heating
    SET_LED_EFFECT EFFECT=sb_nozzle_heating

[gcode_macro status_cooling]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_cooling
    SET_LED_EFFECT EFFECT=sb_nozzle_cooling

[gcode_macro status_leveling]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_leveling
    SET_LED_EFFECT EFFECT=sb_nozzle_leveling

[gcode_macro status_homing]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_homing
    SET_LED_EFFECT EFFECT=sb_nozzle_homing

[gcode_macro status_cleaning]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_cleaning
    SET_LED_EFFECT EFFECT=sb_nozzle_cleaning

[gcode_macro status_meshing]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_meshing
    SET_LED_EFFECT EFFECT=sb_nozzle_meshing

[gcode_macro status_calibrating_z]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_calibrating_z
    SET_LED_EFFECT EFFECT=sb_nozzle_calibrating_z

[gcode_macro status_printing]
gcode:
    STOP_LED_EFFECTS
    SET_LED_EFFECT EFFECT=sb_logo_printing
    SET_LED_EFFECT EFFECT=sb_nozzle_printing
julianschill commented 4 months ago

I have to do some tests to reproduce that and see what's causing it. I don't use the normal SET_LED anymore on my printer and just do static effects when I want a single color. Maybe this works for you as well.

bthubs commented 4 months ago

I have to do some tests to reproduce that and see what's causing it. I don't use the normal SET_LED anymore on my printer and just do static effects when I want a single color. Maybe this works for you as well.

Do you mind sharing an example of what you mean?

julianschill commented 4 months ago

Check you effect "set_nozzle_leds". That switches the nozzle leds on using an effect. So use that instead of just turning them on in Mainsail.

bthubs commented 4 months ago

I use fluidd and I dont change the colors from the interface, I usually use a macro. Is there anything wrong with my macros?

Either way, I'm suspecting a problem with the nitehawk 36 since the problem gets worse when heating up or extruding. I'll connect the harness directly to the motherboard and get back to you.

julianschill commented 4 months ago

What macro are you using specifically? But there is nothing wrong and it should basically work. Might be a problem with updating the neopixels. Can you please post a klippy.log?

bthubs commented 4 months ago

klippy.log

Sorry not sure where to look in this log, its so long... I wasn't getting any errors however. I plugged it into the motherboard (manta m8p). It's showing the same behavior, logo (LED effect - breathing) + nozzle LEDs (static white) = flickering. So it's not the Nitehawk 36. Perhaps it is the 3535 sequins then...?