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
DOS-like OS for RP2040 basic microcontroller boards

Micropython DOS-like OS for RP2040 microcontroller boards. Check out the demo video at https://www.youtube.com/watch?v=Az_oiq8GE4Y To start the OS typ

RetiredWizard 58 Dec 27, 2022
Play music on Raspberry Pi Pico Without CPU involvement

MicroPython_PIO_Music_DMA Play music on Raspberry Pi Pico Without CPU involvement This is based on PIOBeep (https://github.com/benevpi/pico_pio_buzz)

3 Nov 27, 2022
For use with an 8-bit parallel TFT touchscreen using micropython

ILI9341-parallel-TFT-driver-for-micropython For use with an 8-bit parallel TFT touchscreen using micropython. Many thanks to prenticedavid and his MCU

3 Aug 02, 2022
A raspberrypi tools for python

raspberrypi-tools how to install: first clone this project: git clone https://github.com/Ardumine/rpi-tools.git then go to the folder cd rpi-tools and

1 Jan 04, 2022
An embedded application for toy-car controlling based on Raspberry Pi 3 Model B and AlphaBot2-Pi.

An embedded application for toy-car controlling based on Raspberry Pi 3 Model B and AlphaBot2-Pi. This is the source codes of my programming assignmen

StardustDL 4 Oct 19, 2022
The software that powers the sPot: a 4th generation

This code is meant to accompany this project in which a Spotify client is built into an iPod "Classic" from 2004. Everything is meant to run on a Raspberry Pi Zero W.

Guy Dupont 683 Dec 28, 2022
Final-project-robokeeper created by GitHub Classroom

RoboKeeper! Jonny Bosnich, Joshua Cho, Lio Liang, Marco Morales, Cody Nichoson Demonstration Videos Grabbing the paddle: https://youtu.be/N0HPvFNHrTw

Cody Nichoson 1 Dec 12, 2021
LT-OCF: Learnable-Time ODE-based Collaborative Filtering, CIKM'21

LT-OCF: Learnable-Time ODE-based Collaborative Filtering Our proposed LT-OCF Our proposed dual co-evolving ODE Setup Python environment for LT-OCF Ins

Jeongwhan Choi 15 Dec 28, 2022
Blender Camera Switcher

Blender Camera Switcher A simple camera switcher addon for blender. Useful when use reference image for camera. This addon will automatically fix the

Corgice 1 Jan 31, 2022
Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs

Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs

Matthew Garrett 1.2k Jan 04, 2023
♟️ QR Code display for P4wnP1 (SSH, VNC, any text / URL)

♟️ Display QR Codes on P4wnP1 (p4wnsolo-qr) 🟢 QR Code display for P4wnP1 w/OLED (SSH, VNC, P4wnP1 WebGUI, any text / URL / exfiltrated data) Note: Th

PawnSolo 4 Dec 19, 2022
Workshop for student hackathons focused on IoT dev

Scenario: The Mutt Matcher (IoT version) According to the World Health Organization there are more than 200 million stray dogs worldwide. The American

Microsoft 15 Aug 10, 2022
Universal Xiaomi MIoT integration for Home Assistant

Xiaomi MIoT Raw 简体中文 | English MIoT 协议是小米智能家居从 2018 年起推行的智能设备通信协议规范,此后凡是可接入米家的设备均通过此协议进行通信。此插件按照 MIoT 协议规范与设备通信,实现对设备的状态读取及控制。

1.9k Jan 02, 2023
Python Wrapper for Homeassistant's REST API

HomeassistantAPI Python Wrapper for Homeassistant's REST API Please ⭐️ the repo if you find this project useful or cool! Here is a quick example. from

Nate 29 Dec 31, 2022
MicroPython driver for 74HC595 shift registers

MicroPython 74HC595 A MicroPython library for 74HC595 8-bit shift registers. There's both an SPI version and a bit-bang version, each with a slightly

Mike Causer 17 Nov 29, 2022
Automatic Watering System using Soil Moisture Sensor and RTC Timer with Arduino

Automatic-Watering-System - Technical Answers to Real-World Problems. Evolution of Watering Manually to Watering Automatically.

Vaishnavi Pothugunta 4 Dec 31, 2021
CPU benchmark by calculating Pi, powered by Python3

cpu-benchmark Info: CPU benchmark by calculating Pi, powered by Python 3. Algorithm The program calculates pi with an accuracy of 10,000 decimal place

Alex Dedyura 20 Jan 03, 2023
Testing out some (stolen) DMA code for RP2040 Micropython

RP2040_micropython_dma testing out some (stolen) DMA code for RP2040 Micropython. Heavy inspiration and some code from https://iosoft.blog/2021/10/26/

2 Dec 29, 2022
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 07, 2023
Detic ros - A simple ROS wrapper for Detic instance segmentation using pre-trained dataset

Detic ros - A simple ROS wrapper for Detic instance segmentation using pre-trained dataset

Hirokazu Ishida 12 Nov 19, 2022