############### Do not use this. It's not compatible with the latest version of Klipper, and I haven't had time to work on it to sort out proper threading.
Go and take a look at https://github.com/julianschill/klipper-led_effect
###############
This module acts as an upgrade for the existing neopixel module to allow easy setting of patterns and animations in gcode. To use the module in Klipper, replace your existing [neopixel my_neopixels]
entry with [neopixel_utility my_neopixels]
. Existing neopixel commands like SET_LED
will work as before.
- Ability to select a pattern of lights either from a predefined pattern, or by specifying a series of colours to repeat
- Ability to animate LEDs using either the starting state of the LEDs or a specific pattern for that animation
- Simple gamma correction to turn linear RGB values into something more aligned to a perceived linear brightness scale.
Configuration is the same as a standard [neopixel]
block, with two optional configuration entries:
gamma: 2.7
# Sets the value used for gamma correction. Defaults to 2.7, which seems a reasonable value for neopixels
gamma_adjust: True
# Enable or disable the gamma adjustment of the new functions. Defaults to True.
The basic pattern command is as follows:
SET_LED_PATTERN LED=my_neopixels PATTERN=Random RANGE=1,10
If no pattern is specified, then the pattern will be randomised. The optional Range parameter defines which LEDs to change (inclusive). Specific patterns have additional optional arguments.
Rando rando rando
ASCENDING=0/1 Currently white LEDs only
Custom repeating pattern CUSTOM=red|green|blue|orange
Patterns should be delimited with pipe characters (|
). Colours are defined using their human, web compatible representation (e.g. red
), or by rgb values (e.g. rgb=(1,0,0)
). Don't include quote marks.
e.g. A custom pattern for red, white, and blue could be defined as CUSTOM=red|rgb=(1,1,1)|darkblue
The basic animation command is as follows:
SET_LED_ANIMATION LED=my_neopixels ANIMATION=March RANGE=1,10
If no animation is specified, then the March animation will be used. The optional Range parameter defines which LEDs to change (inclusive). Specific animations have additional optional arguments.
ASCENDING=1 SPEED= 0.1 DURATION=5
SPEED=0.05 COLOUR=red DURATION=5 ASCENDING=1
- Better error handling
- Slightly smarter gamma correction
- Make animations run in parallel
- Add more patterns (coloured gradient / palette)
- Add more animators (pulse, strobe, raindrops, lightning, fade, loading, etc.)
- Add a quick utility for taking a colour fom a palette - useful for things like temperature settings
Checkout the repo in the home directory and install using the following commands:
cd ~
git clone https://github.com/falo2k/klipper_neopixel_utility.git
source ~/klippy-env/bin/activate
pip install -r ~/klipper_neopixel_utility/requirements.txt
deactivate
Use the following block in your moonraker configuration for automatic updates. This is currently set to the dev channel as it's a work in progress.
[update_manager neopixel_utility]
type: git_repo
path: ~/klipper_neopixel_utility
origin: https://github.com/falo2k/klipper_neopixel_utility.git
primary_branch: dev
# The name of the primary branch used for release code on this repo. This
# option allows clients to specify 'main', or their own unique name, as
# the branch used for repo validity checks. The default is master.
# dev is my testing branch, main should be stable
env:~/klippy-env/bin/python
requirements:requirements.txt
install_script: install.sh
# Note that the install will put a symlink in ~/klipper/klippy/extras/ to use the
# module
is_system_service: False