Skip to content

Instantly share code, notes, and snippets.

@bistory
Created July 14, 2022 05:32
Show Gist options
  • Save bistory/917be092c1fe3b169ec366476644afbb to your computer and use it in GitHub Desktop.
Save bistory/917be092c1fe3b169ec366476644afbb to your computer and use it in GitHub Desktop.
Macros pour ajouter des ambiances RGB à votre Voron
# Macros for setting the status leds on the Voron enclosure (or for any neopixel-type leds).
#
# You will need to configure a neopixel (or other addressable led, such as dotstar). See
# https://www.klipper3d.org/Config_Reference.html#neopixel for configuration details.
#
# CONFIGURATION
#
# Example neopixel configuration:
# [neopixel caselight]
# pin: <your pin>
# # The pin connected to the neopixel. This parameter must be
# # provided.
# chain_count: 54
# # 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: GRBW
# # Set the pixel order required by the LED hardware. Options are GRB,
# # RGB, GRBW, or RGBW. The default is GRB.
# initial_RED: 0.0
# initial_GREEN: 0.0
# initial_BLUE: 0.0
# initial_WHITE: 0.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.#
#
# Most configuration for the macros can be done by modifying the variables in the _sb_vars macro
# at the start of this file.
#
# MACROS
#
# The following status macros are available:
# CASELIGHT_ON ; All on
# CASELIGHT_OFF ; All off
# CASELIGHT_HEATING ; Yellow logo and nozzle
#
# You will need to add the status macros into your configuration before the matching command
#
# Example:
# [gcode_macro print_start]
# gcode:
# CASELIGHT_ON
# G28
# CASELIGHT_HEATING
# M140 S{bed_temp}
# M104 S{e0_temp}
# ...
# CASELIGHT_OFF
#
# Contributed by Voron discord users wile.e, Tetsunosuke, and etherwalker
[gcode_macro _enclosure_vars]
# User settings for the StealthBurner status leds. You can change the status colors and led
# configurations for the logo and nozzle here.
variable_colors: {
'off': {'r': 0.0, 'g': 0.0, 'b': 0.0, 'w': 0.0},
'on': {'r': 0.8, 'g': 0.8, 'b': 0.8, 'w':1.0},
'heating': {'r': 0.8, 'g': 0.35, 'b': 0.0, 'w':0.0},
}
variable_led_name: "caselight"
# The name of the addressable LED chain that contains the logo LED(s)
gcode:
; Do nothing
[gcode_macro _set_caselight_leds]
gcode:
{% set color_name = params.COLOR %}
{% set color = printer["gcode_macro _enclosure_vars"].colors[color_name] %}
{% set led = printer["gcode_macro _enclosure_vars"]["led_name"] %}
set_led led={led} red={color.r} green={color.g} blue={color.b} white={color.w}
[gcode_macro caselight_on]
gcode:
_set_caselight_leds color="on"
[gcode_macro caselight_off]
gcode:
_set_caselight_leds color="off"
[gcode_macro caselight_heating]
gcode:
_set_caselight_leds color="heating"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment