LED effects plugin for klipper

Overview

LED Effects for Klipper.

This plugin allows Klipper to run effects and animations on addressable LEDs, such as Neopixels, WS2812 or SK6812.

The main work has been done by Paul "Mental" McGowan.

Installation

cd ~
git clone https://github.com/julianschill/klipper-led_effect.git
cd klipper-led_effect
./install-led_effect.sh

Configuration

Documentation can be found here.

Comments
  • Problem with colors after update

    Problem with colors after update

    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

    bug question 
    opened by panik988 17
  • Internal error during ready callback:

    Internal error during ready callback:

    Hello,

    After using this for a day or so I started tweaking some more effects for my usecase. While doing so I pressed the save and restart button while an effect was still active. Resulting in Internal error during ready callback: 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 go into my loggfile I can find the following error mentioned :

    Unhandled exception during ready callback
    Traceback (most recent call last):
      File "/home/pi/klipper/klippy/klippy.py", line 205, in _connect
        cb()
      File "/home/pi/klipper/klippy/extras/led_effect.py", line 397, in _handle_ready
        
      File "/home/pi/klipper/klippy/extras/led_effect.py", line 740, in __init__
    
        
    MemoryError
    Transition to shutdown state: Internal error during ready callback: 
    

    removing the led_effects plugin solves this and I can re-use my printer. doing a fresh install of the led_effect plugin now causes the same behaviour of the above message. (I believe that it has written something in the MCU memory?)

    any way to solve this without me needing to reflash both my MCU's? klippy (2).log

    bug fixed_in_next_version 
    opened by BelgianGuyWithALaser 16
  • RGB to RGBW color conversion with color temperature

    RGB to RGBW color conversion with color temperature

    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.

    enhancement 
    opened by julianschill 12
  • LED effects seem to cause issue with recent update

    LED effects seem to cause issue with recent update

    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.

    bug 
    opened by srothwel 11
  • Error config

    Error config

    I put into config this code from docs:

    [led_effect critical_error]
    leds:
        neopixel:tool_lights
        neopixel:bed_lights
    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
    

    And I have error:

    Internal error during ready callback: 'float' object cannot be interpreted as an integer
    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
    

    In log:

    Traceback (most recent call last):
      File "/home/klipper/klipper/klippy/klippy.py", line 205, in _connect
        cb()
      File "/home/klipper/klipper/klippy/extras/led_effect.py", line 382, in _handle_ready
        self.layers.insert(0, layer(handler       = self,
      File "/home/klipper/klipper/klippy/extras/led_effect.py", line 659, in __init__
        for c in range(0, len(self.paletteColors)):
    TypeError: 'float' object cannot be interpreted as an integer
    Transition to shutdown state: Internal error during ready callback: 'float' object cannot be interpreted as an integer
    
    bug enhancement 
    opened by dagov42 10
  • Leds flickering when printing

    Leds flickering when printing

    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

    opened by quicksilverstar 9
  • SET_LED after gets overwritten after stopping LED effects

    SET_LED after gets overwritten after stopping LED effects

    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

    bug question fixed_in_next_version 
    opened by julianschill 8
  • How do I start with one effect then after a time, automatically switch to another?

    How do I start with one effect then after a time, automatically switch to another?

    I see the FADETIME option but it seems that has to be tied to a macro? I'd like the machine to boot up with one effect then after a couple seconds switch to another one. Imagine a comet effect for a couple seconds then switching to a static color. Can I use the FADETIME as part of the effect description and make it autostart: true ?

    opened by Gliptopolis 7
  • "AttributeError: PrinterNeoPixel instance has no attribute 'led_helper'" When effect is in config

    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.

    opened by ryryog25 6
  • Repeated

    Repeated "Neopixel update did not succeed" error until klipper crashes

    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 .

    opened by drb1981 5
  • After new Klipper update Printer wont boot with certain effect enabled. Zero error message just cant connect to mcu

    After new Klipper update Printer wont boot with certain effect enabled. Zero error message just cant connect to mcu

    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.

    opened by Jo3yDaPh1sH 5
  • Internal error caused by combination of effects

    Internal error caused by combination of effects

    When I tried to use a set of effects by adding it to the configuration file and restarting klipper, Klipper wouldn't start citing: Internal error during ready callback: 'colorArray' object has no attribute 'copy'

    This is what I added:

    autostart:              false
    frame_rate:             24
    leds:
        neopixel:caselight
    layers:
        pattern    0.4   1.0      add   (0.0, 0.5, 1.0), (0.3, 0.5, 0.5), (0.0, 1.0, 0.0) 
    

    I found that I could swap pattern with other styles to make it work. This pattern config worked great in the simulator.

    bug fixed_in_next_version 
    opened by spikeygg 3
  • Unknown command:

    Unknown command: "STOP_LED_EFFECTS"

    Hey I have this mostly set up and working, but was looking for a way to turn off the LEDs. I found the STOP_LED_EFFECTS gcode command in the documentation, but klipper doesn't seem to recognize is. Followed the install instruction in the readme and haven't noticed any errors in my logs.

    Any advice? Thanks!

    opened by abrenoch 1
  • Install Path changes

    Install Path changes

    Since Klipper is now using $ { HOME } /printer_data/config instead of $ { HOME } /klipper_config/ it might be a good idea to update the install script, maybe have a legacy version available for those with older installs also.

    fixed_in_next_version 
    opened by mlee12382 1
  • This specific config crashes the latest klipper version

    This specific config crashes the latest klipper version

    I did a little experiment that didn't work but still had this config section in my led_effects.cfg file: `#####################

    whole_top_strip

    #####################

    [led_effect top_strip_stroboscope] leds: neopixel:top_strip autostart: false frame_rate: 60 layers: strobe 110 100 top (0.0, 0.0, 0.0, 1.0)

    [gcode_macro stroboscope] gcode: STOP_LED_EFFECTS SET_LED_EFFECT EFFECT=top_strip_stroboscope`

    when starting klipper after I updated tonight, I got this error message. This was only happening on the chain connected to my klipper expander, so I tried upgrading the mcu there and on the octopus for good measure to all be on the latest klipper version, but no luck until I figured out it was this led effect that caused it, giving the following error in klippy.log:

    Unhandled exception during run Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 217, in run self.reactor.run() File "/home/pi/klipper/klippy/reactor.py", line 292, in run g_next.switch() File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop timeout = self._check_timers(eventtime, busy) File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers t.waketime = waketime = t.callback(eventtime) File "/home/pi/klipper/klippy/extras/led_effect.py", line 177, in _getFrames frames = [(effect, effect.getFrame(eventtime)) for effect in self.effects] File "/home/pi/klipper/klippy/extras/led_effect.py", line 177, in <listcomp> frames = [(effect, effect.getFrame(eventtime)) for effect in self.effects] File "/home/pi/klipper/klippy/extras/led_effect.py", line 413, in getFrame layerFrame = layer.nextFrame(eventtime) File "/home/pi/klipper/klippy/extras/led_effect.py", line 485, in nextFrame return self.thisFrame[self.frameNumber] IndexError: list index out of range Transition to shutdown state: Unhandled exception during run klippy (10).log

    Full klippy.log attached to the issue.

    enhancement fixed_in_next_version 
    opened by Nyegaard 3
  • Example for daisy chained LEDs

    Example for daisy chained LEDs

    Hi @julianschill

    could you please provide an example on how the configuration would look like for daisy chained LEDs on a single PIN? For example PB0 on a Octopus 1.1 with four segments of WS2812b.

    Thank you for your help!

    support 
    opened by andreklug 6
Releases(v0.0.9)
  • v0.0.9(Nov 15, 2022)

    What's Changed

    Improvements and fixes

    • Updated simulator for heater and stepper effects
    • Fix bug in heater effect by @Nailig in https://github.com/julianschill/klipper-led_effect/pull/97
    • Optimize enabling and disabling so it executes immediately
    • Better error handling when only defining one color for chase effect

    New effects:

    • Temperature sensor: color based on temperature of temperature sensors, that don't have a target value
    • Stepper Color: Color based on position of axis
    • Pattern: A pattern, that gets shifted along the chain

    New Contributors

    • @Nailig made their first contribution in https://github.com/julianschill/klipper-led_effect/pull/97 Thank you!

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.8...v0.0.9

    Source code(tar.gz)
    Source code(zip)
    ledeffect-simulator-macos.zip(16.35 MB)
    ledeffect-simulator-win.exe(15.98 MB)
  • v0.0.8(Oct 23, 2022)

  • v0.0.7(Oct 6, 2022)

    This update adds direct RGBW support. Define your colors with either 3 or 4 values. If the 4th value is provided, it will be sent to the white LED of your RGBW strip.

    The conversion from RGB to RGBW has been completely removed, so your colors might look different after the update.

    What's Changed

    • RGBW support by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/90
    • Added documentation for RGBW support by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/92
    • Merge develop into master by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/93

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.6...v0.0.7

    Source code(tar.gz)
    Source code(zip)
  • v0.0.6(Sep 21, 2022)

    What's Changed

    Configuration changes

    • Cut-off for gradient effect now determines the length of the gradient

    New Features and Bugfixes

    • Python3 compatibility by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/66
    • Python3 by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/68
    • Julianschill/issue61 Disable effects for specific LEDs by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/80
    • Fixes progress effect to turn off all LEDs when progress==0 by @guru-florida in https://github.com/julianschill/klipper-led_effect/pull/73
    • Make finer transition for gradient effect by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/86
    • Calculation of stepper position (as %) is incorrect for non-zero min … by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/87

    New Contributors

    • @guru-florida made their first contribution in https://github.com/julianschill/klipper-led_effect/pull/73

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.5...v0.0.6

    Source code(tar.gz)
    Source code(zip)
  • v0.0.5(Jun 25, 2022)

    What's Changed

    • Python3 compatibility (#66) by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/67

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.4...v0.0.5

    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Jun 25, 2022)

    Bugfix Release

    What's Changed

    • Julianschill/issue3 by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/33
    • Support temperature fans for heater effects by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/34
    • diffuse from heatsource, not LED 3 by @ksanislo in https://github.com/julianschill/klipper-led_effect/pull/27
    • Julianschill/issue38 by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/39
    • Julianschill/issue38 by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/40
    • Fix effects for new klipper implementation by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/43
    • Fix for newest Klipper update. Fix shutdown handling. by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/53
    • Fix for newest Klipper update. Fix shutdown handling. (#53) by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/54

    New Contributors

    • @ksanislo made their first contribution in https://github.com/julianschill/klipper-led_effect/pull/27

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.3...v0.0.4

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Jan 24, 2022)

    This is the alpha for the upcoming 0.1.0 release. Please use with care and report any bugs.

    What's Changed

    • Fixed all effect layers @julianschill in https://github.com/julianschill/klipper-led_effect/pull/18
    • Fix color order handling and offset handling for dotstar LEDs by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/22
    • Fix reverse direction behaviour of comet and chase by @julianschill in https://github.com/julianschill/klipper-led_effect/pull/26
    • Support for tabulator in effect layer config by @TodWulff in https://github.com/julianschill/klipper-led_effect/pull/23

    Known issues:

    • Documentation is not up-to-date
    • Effects, that run concurrently on the same LED are not added, but overwritten
      • Work-around: Use SET_LED_EFFECT EFFECT=<name> STOP=1 or STOP_LED_EFFECTS to stop an effect or all effects prior to starting a new one
    • Due to lack of peripheral support for neopixels in Klipper, effects might be interrupted by motor movements
      • Work-around: Use a separate MCU (e.g. KlipperExpander) for controlling LEDs.

    New Contributors

    • @julianschill made their first contribution in https://github.com/julianschill/klipper-led_effect/pull/18
    • @TodWulff made their first contribution in https://github.com/julianschill/klipper-led_effect/pull/23

    Full Changelog: https://github.com/julianschill/klipper-led_effect/compare/v0.0.2...v0.0.3

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Nov 13, 2021)

  • v0.0.1(Nov 13, 2021)

Owner
Julian Schill
Julian Schill
A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

Jérôme W. 75 Jan 7, 2023
My 500 LED xmas tree

xmastree2020 This repository contains the code used for Matt's Christmas tree, as featured in "I wired my tree with 500 LED lights and calculated thei

Stand-up Maths 581 Jan 7, 2023
An emulated LED scoreboard for Major League Baseball ⚾

An LED scoreboard for Major League Baseball. Displays a live scoreboard for your team's game on that day.

Tyler Porter 8 Apr 8, 2022
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

Martin Woodward 6 Nov 13, 2021
Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;)

TMorse Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;) Compatible with python3.9+. No third-party library is required

Mahyar 2 Jul 11, 2022
A simple program to make MSI Modern 15 speaker and microphone mute led work.

MSI Modern 15 sound led fixup for linux A simple program to fix the MSI Modern 15 speaker and microphone mute LEDs. Installation Requirements pulsectl

Seyed Danial Movahed 4 Oct 18, 2022
SPI driven CircuitPython driver for PCA9745B constant current LED driver.

Introduction THIS IS VERY MUCH ALPHA AND IN ACTIVE DEVELOPMENT. THINGS WILL BREAK! THIS MAY ALSO BREAK YOUR THINGS! SPI driven CircuitPython driver fo

Andrew Ferguson 1 Jan 14, 2022
This is an incredible led matrix simulation using the ultimate mosaik co-simulation framework.

This project uses the mosaik co-simulation framework, developed by the brilliant developers at the high-ranked Offis institue for computer science, Oldenburg, Germany, to simulate multidimensional LED matrices.

Felix 1 Jan 28, 2022
Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the cost of the day.

Johan Jonk Stenström 3 Sep 8, 2022
This OctoPrint plugin will make the initial connection to 3D Hub a breeze

3D Hub Connector This OctoPrint plugin will make the initial connection to 3D Hub a breeze. In future it will help in setting up a tunnel connection a

3D Hub 2 Aug 3, 2022
A Klipper plugin for accurate Z homing

Stable Z Homing for Klipper A Klipper plugin for accurate Z homing This plugin provides a new G-code command, STABLE_Z_HOME, which homes Z repeatedly

Matthew Lloyd 24 Dec 28, 2022
LedFx is a network based LED effect controller with support for advanced real-time audio effects

Welcome to LedFx ✨ -Making music come alive! LedFx website: https://ledfx.app/ What is LedFx? What LedFx offers is the ability to take audio input, an

null 786 Jan 2, 2023
This repository contains numerical implementation for the paper Intertemporal Pricing under Reference Effects: Integrating Reference Effects and Consumer Heterogeneity.

This repository contains numerical implementation for the paper Intertemporal Pricing under Reference Effects: Integrating Reference Effects and Consumer Heterogeneity.

Hansheng Jiang 6 Nov 18, 2022
A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

A set of postprocessing scripts and macro to accelerate the gyroid infill print speed with Klipper

Jérôme W. 75 Jan 7, 2023
The Official Twilio SendGrid Led, Community Driven Python API Library

The default branch name for this repository has been changed to main as of 07/27/2020. This library allows you to quickly and easily use the SendGrid

Twilio SendGrid 1.4k Jan 7, 2023
My 500 LED xmas tree

xmastree2020 This repository contains the code used for Matt's Christmas tree, as featured in "I wired my tree with 500 LED lights and calculated thei

Stand-up Maths 581 Jan 7, 2023
An emulated LED scoreboard for Major League Baseball ⚾

An LED scoreboard for Major League Baseball. Displays a live scoreboard for your team's game on that day.

Tyler Porter 8 Apr 8, 2022
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

Martin Woodward 6 Nov 13, 2021