julianschill / klipper-led_effect Goto Github PK
View Code? Open in Web Editor NEWLED effects plugin for klipper
License: GNU General Public License v3.0
LED effects plugin for klipper
License: GNU General Public License v3.0
Currently im doing effects for my StealthBurner LEDs but it looks like when i set 2 effects that they both remain on which is fine.
It would be nice to have the ability to turn off all effects for specific LEDs like sb_leds which are 3 neopixels. And best would be to have the ability to turn off also a range of them. Like sb_leds (2-3).
For now i have to turn off all the effects that are defined for the specific LEDs. And since there is like 10 of them for only sb_leds you can imagine this is less then ideal.
So my printer sits idle with two effects running, a rainbow gradient for case lights and one for stealthburner leds. In my print_start I call SET_LED_EFFECT EFFECT=party STOP=1 and SET_LED_EFFECT EFFECT=party2 STOP=1 to stop that effect and then I call a standard klipper set_led command to set the case lights to full white, and then the SB macro for STATUS_HEATING.
Sometimes this all works correctly, most times what happens is the effects stop, the case lights do NOT set to white and the SB does set to status heating, sometimes neither LED strip gets set and they're just off after the effects turn off.
If I do it manually it's fine, if I put the set led calls later in the Print_start macro it's fine, it seems like a timing issue of some sort, like they're being executed too close together and something doesn't work right
As requested, this is your reminder... ;-)
"Hagbard V2.1070 Thank you. I think I know what the issue is. I made a change to read the color_order from the config, and apparently for dotstar there isnt such a configuration. So for dotstar I have to assume the default color order. Should be a quick fix, once I'm home. Would you mind creating an issue on github as a reminder for me?"
Thread start: https://discord.com/channels/460117602945990666/635687829254701107/925020306156970024
I would like to have a temp status light for MCU and Pi Host CPU temps.
An endstop state would also be useful.
This is the line in printer.cfg that plots the temp in the on-screen graph if that helps.
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor pico]
sensor_type: temperature_mcu
sensor_mcu: pico
min_temp: 10
max_temp: 100
The RGB colors are converted to RGBW values, when a RGBW strip is connected. This also means, that a color temperature has to be configured.
Currently the color temperature of the white led is hardcoded. This has to be moved to the configuration.
This issue collects all typos and spelling errors in the documentation. So if you encounter one, feel free to put a comment here.
Effects should solely rely on temperature values. Heaters, temperature_fans or temperature_sensors can be used as input.
Hi, sorry to report this but I am have a problem with klipper-led-effect while printing, I have two channels
One for a status led with 8 led and a toolhead led with 2
While printing I am finding that the blink is very random and flicker and the toolhead led are while and will just turn on and off random
I have the led on a decated controller running klipper firmware
When I run the gcode when not printing it will work fine
I am running the latest klipper and fluidd software
How to set the led to white at full brightness?
I tried:
layers:
static 0 0 bottom (1.0,1.0,1.0)
It would be nice if the white channel on SK6812 RGBW strips would be usable too.
Thanks!
Also support temperature fans, which also have a target temperature and a set temperature, for heater and heater_fire.
Hi, I'm not terribly familiar with this stuff, but after installing the plugin via the provided install script and adding an effect to my printer config, I get:
Unhandled exception during run
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 201, in run
self.reactor.run()
File "/home/pi/klipper/klippy/reactor.py", line 269, in run
g_next.switch()
File "/home/pi/klipper/klippy/reactor.py", line 310, in _dispatch_loop
timeout = self._check_timers(eventtime, busy)
File "/home/pi/klipper/klippy/reactor.py", line 156, in _check_timers
t.waketime = waketime = t.callback(eventtime)
File "/home/pi/klipper/klippy/extras/led_effect.py", line 192, in _getFrames
chain.led_helper.led_state[index] = (0.0, 0.0, 0.0, 0.0)
AttributeError: PrinterNeoPixel instance has no attribute 'led_helper'
Transition to shutdown state: Unhandled exception during run
I've got this in my config:
#############
# Neopixels #
#############
[neopixel rail_light]
pin: P1.24
chain_count: 25
color_order: GRB
initial_RED: .5
initial_GREEN: 0
initial_BLUE: .5
[led_effect idle]
autostart: true
frame_rate: 24
leds:
neopixel:rail_light (1-25)
layers:
breathing 10 1 top (.5,.5,1)
I'm not quite sure if this is a bug or user error on my part, and I'm not sure what to do in order to troubleshoot this.
Thank you in advance for any help.
It seems that SET_LED_EFFECT will only trigger an effect once.
Example
SET_LED_EFFECT EFFECT=a
works
SET_LED_EFFECT EFFECT=b
works
SET_LED_EFFECT EFFECT=a
stays on 'b'
after i update all in moonranker i get this issues : Internal error during connect: invalid syntax (led_effect.py, line 504)
In principle, this effect is great but it doesn't seem to work. I have it configured like this
[...]
[neopixel chamber]
pin: P1.24
chain_count: 144
initial_RED: 0.031
initial_GREEN: 0.031
initial_BLUE: 0.031
color_order: GRB
[...]
[led_effect preheat]
leds:
neopixel:chamber (106-140)
autostart: true
frame_rate: 24
heater: heater_bed
layers:
heater 45 1 top (0,1,0),(1,0,0)
I expected this to start up green, then transition to red as the bed heats up, but it just stays a solid green until it finally goes out when the bed reaches temperature.
Maybe I'm doing it wrong?
Love the LED effects, but I have just updated Klipper, Moonraker and the Raspberry Pi OS via the links in Fluid and now I get an error 'internal error during ready callback: PrinterNeoPixel instance has no attribute 'chain_count' If I comment out the effects in the config file then everything back to normal but no LED Effects. Declaring Neopixels in the config is still okay just not the effects.
With any LED effects enabled klipper continuously gives "Neopixel update did not succeed" error until klipper overloads and crashes. Fresh install of klipper and LED control module installed did not resolve issue.
klippy (5).log
.
The heater and heater fire animations when set to cutoff 1 do not stop working when the heater cools, they just stop displaying. For example if you use the 2 config examples and autostart bed efects and pannel idel the machine will breathe as it powers on, display fire untill temp and shutoff. pn cooling it displays back down untill min temp but then it stop breathe starting and stays on the first colour of the fire animation list, eg red.
Check if an LED configured in the effect is out of bounds
Hi,
I wonder if the devs could comment on how this plugin differs from (or interact with) this new PR to Klipper: Klipper3d/klipper#5374? Is there any thing we should be aware of when using one or the other?
Starting to get this setup when I went to the link for example-extras.cfg in the LED_EFFECT.md, the link to the file is invalid.
The frame handler has changed and not all effects have been adjusted to that new format. The following effects currently do not work and have to be updated:
Add a parameter to SET_LED_EFFECT to specify a fading time. This willbe used to fade in an effect when starting it and fade out an effect when stopping it.
Currently the communication with the LEDs is done in software, which needs a lot of resources. The goal would be to use microcontroller hardware support for the communication. This could also be done for the Raspberry Pi.
This is something, that has to be done directly in Klipper and is only loosely related to this project. This issue is just a reminder.
Currently there is only a command to stop all Effects (STOP_LED_EFFECTS), but it would be useful to be able to deactivate single effects.
Hi,
is it possible to make an effect like k2000, comet in one direction then in the other ?
Thanks
Nice work! Does this surpport Klipper Python3?
having a simulator to experiment the different options would be cool and save hundreds of innecessary restarts of klipper :)
Great work!
It seems I need to define multiple led_effect to indicate one printer statue if I want to have different effects on different LEDs. Am I missing something? If not, is there any plan to change the way of defining led_effect?
Also, it would be helpful if I can directly configure part of the LED strips as curent "leds".
Not native English user, sorry for the grammary fault.
Hi,
I noticed that when my z-axis is closer to the print bed, the LEDs on the extruder reflects too much light causing my streaming camera to lost all the details.
Is there a way to dim LEDs based on position of a stepper?
is it possible to Control a wled string with the script ?
As you mull on the roadmap for LED_Effects, please consider adding a gauge effect for things such as axis position, axis velocity/rates, temps, completion percentage, etc. This would enable using led strips or matrices to visually display operating parameters in [near-] real-time.
An example use case is depicted here: https://i.imgur.com/BV00C4y.png (granted, X/Y/Z position indications are sort of redundant considering one can just look at the printer volume if in visual proximity of the printer, but having the axis' needle color modulated based on velocity - green to yellow to red would ratchet the neatness/geek factor through the roof, and one would be able to position the led strip/array away from the printer itself (i.e. on the wall or desk of the upstairs office when the printer is downstairs in the basement or located in a different room).
Also, if an axis' end-stop trigger could be detected, said axis background could be strobed a configurable color. Each gauge's background could be a user defined pallet, with the 'gauge needle' separately definable and possibly dynamic (i.e. velocity based color change on the axis position indication, as described above - considering the sample image, doing so could free up a couple of the led rows/columns for use to depict other gauges, etc.).
Other gauges that come to mind are MCU temp, Chamber Temp, Fan Operation Verification (speeds), humidity, and connectivity/machine state indication (not necessarily an element appropriate for depicting via a gauge, and likely possible to implement currently, but stated in the interests of stimulating thought and completeness).
Anyways, please advise if additional dialog is warranted/needed/desired. Take care and Thank You for your continued effort on this Klipper module. It is most appreciated.
-t
At the moment the effect for LEDs gets overwritten by the other effect, when the LED belongs to multiple active effects. The desired behaviour is that they blend together, so that both effects are visible.
I suppose what I have in mind is a feature request.
Currently,
Defined effect called panel_idle that can be controlled via the gcode command SET_LED_EFFECT EFFECT=panel_idle. Calling the command enables this effect. It can be disabled again by calling SET_LED_EFFECT EFFECT=panel_idle STOP=1`
What I would like to propose is perhaps when running a command that is already in effect, turns it off, instead of requiring STOP=1
Or perhaps the author has a different approach in mind where one could toggle a particular set of LEDs (enclosure lights for example) on/off via a physical gcode_button.
I understand not many people have physical buttons so I'll understand if it is not considered.
First of all thanks for making this and making it available to us, really cool project!
I made the following config to light up my led strip in red, when the extruder heater is trying to reach a target temperature and be white when it is idle or reached its temperature:
[led_effect tool_effects]
autostart: true
frame_rate: 24
heater: extruder
leds:
neopixel:leds
layers:
heater 50 1 top (1,0,0),(1,1,1)
static 0 0 add (1,1,1)
This works, but it also turn the heater layer back on when the extruder heater is switched off, resulting in the led strip also becoming red when it is cooling down before it reaches 50. Is this by design and if so how should I configure this so that it only turns red when the extruder is heating up?
Maybe I have missed something obvious. but is there a way to turn off all effect so that the next effect if enabled can be the only one on. unless auto set lights. I want Macros to be able to be set at the start, mid and end of a print. I know I can right long code repeating all possible effects that might be on. but an all off would be good.
Please add the ability to reverse the fire effect.
Changing the effect rate to negative does not affect the direction of comet.
reproduce:
comet -1 1 top (0.8, 1.0, 1.0),(0.0, 0.8, 1.0),(0.0, 0.0, 1.0)
and
comet 1 1 top (0.8, 1.0, 1.0),(0.0, 0.8, 1.0),(0.0, 0.0, 1.0)
have the same direction starting from the first led in a chain.
Hi,
Thank you for developing this cool project. I have cheked my strip voltage, it's stable at 5v and isolated it from other wires, but it seems to be flickering. Do you have any other ideas to fix it?
Please consider and evaluate feasibility of being able to instantiate/define an effect from gcode during runtime.
Having to have a myriad of possible effects defined at service startup that aren't editable/callable with parameters/variables is cumbersome.
Thank you, in advance.
-t
Hello,
before the last update all the configured colors worked correctly.
After the last update instead of having the red led I have the green one.
The neopixel configuration is correct, the problem seems to be the plugin.
Thank you
Hi
I would love to see more examples for each effect and not just short info.
for example a chase of gradient rainbow effect.. and so on.
Hi,
first I want to say that you did great work.
Unfortuanly I don`t know where to put in the "color_order_GRB: true" statement.
I´ve tried in the config of my LED, in the config of my LED-Effect and in the config of the LED-Effect in the leds: section.
Please give me a hint.
Best regards
Markus
When I have a Led Effect defined as Comet, Bed Temp, Progress or twinkle, the newest version of klipper v0.10.0-384-g5517a856 fails to start with only a cannot connect to mcu error. Once those lines are removed it boots fine. So far static and linear fade have worked.
Love the idea and the limited implementation so far but i hope you continue develoment
The gradient effect is not very smooth, when there are only few LEDs. The transition has to be rewritten to make it smoother.
Hello!
I installed everything as per to the instructions but when I define the effects, on the config file, printer does not start up.
[neopixel chamber_neopixel]
pin = PB6
chain_count = 69
[led_effect panel_idle]
autostart = true
frame_rate = 24
leds =
neopixel:chamber_neopixel
layers =
breathing 10 1 bottom (0.5,0.5,1.0)
I get this message:
Unhandled exception during run
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown
Just to clarify, my LEDs work fine, and I don't believe that's the issue.
Nice work. Though the docs is a little hard to understand.
I can't seem to get critical_error to work, even when i get errors mid print or mcu shutsdown.
I have it set to
[led_effect critical_error]
leds:
neopixel:case_light (1, 9, 10, 18)
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: 30
run_on_error: true
Installed via the script, using the "breathing panel_idle" lines in the config doc, I get an error from klipper
Internal error during ready callback: could not convert string to float: [(.5
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown
If I try and make my own code, addressing arrays of LEDs hooked to my printer, I get index out of range errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.