VoronV0_klipper/caselight.cfg

117 lines
3.6 KiB
INI

#####################################################################
# Lighting Control
#####################################################################
## Neopixel interface
[neopixel neo_leds]
pin: RGB
chain_count: 17
color_order: GRBW
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 0.0
initial_WHITE: 0.1
#####################################################################
# Macros
#####################################################################
[gcode_macro _CASELIGHT]
default_parameter_COLOR: 'white'
variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
'orange': (1.0, 0.5, 0.0, 0.0),
'yellow': (1.0, 1.0, 0.0, 0.0),
'charteuse': (0.5, 1.0, 0.0, 0.0),
'green': (0.0, 1.0, 0.0, 0.0),
'turquiose': (0.0, 1.0, 0.5, 0.0),
'springgreen': (0.0, 1.0, 0.5, 0.0),
'cyan': (0.0, 1.0, 1.0, 0.0),
'azure': (0.0, 0.5, 1.0, 0.0),
'ocean': (0.0, 0.5, 1.0, 0.0),
'blue': (0.0, 0.0, 1.0, 0.0),
'violet': (0.5, 0.0, 1.0, 0.0),
'purple': (0.5, 0.0, 1.0, 0.0),
'magenta': (1.0, 0.0, 1.0, 0.0),
'raspberry': (1.0, 0.0, 0.5, 0.0),
'rose': (1.0, 0.0, 0.5, 0.0),
'white': (0.0, 0.0, 0.0, 4.0),
'off': (0.0, 0.0, 0.0, 0.0) }
variable_leds: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
gcode:
# Grab the color values
{% set tuple = colors.get(COLOR|lower, (0.0, 0.0, 0.0, 0.7)) %}
{% set R = tuple[0] %}
{% set G = tuple[1] %}
{% set B = tuple[2] %}
{% set W = tuple[3] %}
{action_respond_info("LED Tuple: {0}".format(tuple))}
{% for I in leds %}
SET_LED LED=neo_leds RED={R} GREEN={G} BLUE={B} WHITE={W} INDEX={I} TRANSMIT={loop.last|int} SYNC=0
{% endfor %}
[gcode_macro _caselight_state]
gcode:
{action_respond_info("Caselight %s" % (printer["gcode_macro CASELIGHT"].state))}
[gcode_macro _CASELIGHT_ON]
gcode:
SET_GCODE_VARIABLE MACRO=CASELIGHT VARIABLE=state VALUE='"on"'
_CASELIGHT
_caselight_state
[gcode_macro _CASELIGHT_OFF]
gcode:
SET_GCODE_VARIABLE MACRO=CASELIGHT VARIABLE=state VALUE='"off"'
_CASELIGHT color='"off"'
_caselight_state
[gcode_macro CASELIGHT]
variable_state: 'on'
gcode:
{%if printer['gcode_macro CASELIGHT'].state == "off" %}
_CASELIGHT_ON
{% else %}
_CASELIGHT_OFF
{% endif %}
[delayed_gcode _STATUS_LED_INIT]
initial_duration: 1
gcode:
_STATUS_LED COLOR=BLUE
[gcode_macro _STATUS_LED]
default_parameter_BLINK: 0
variable_color: 'ORANGE'
variable_restore: 'GREEN'
variable_index: 17
variable_blink: 0
variable_blinkNext: 0
gcode:
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
{% set var_restore=printer["gcode_macro _STATUS_LED"].restore %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blink VALUE={BLINK}
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={BLINK|float}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=restore VALUE='"{var_color}"'
{% if params.COLOR %}
#_SET_LEDS color={COLOR} index={var_index}
{% else %}
#_SET_LEDS color={var_restore} index={var_index}
{% endif %}
[delayed_gcode _STATUS_LED_BLINK_DELAY]
gcode:
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
{% if printer["gcode_macro _STATUS_LED"].blinkNext|int == 0 %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blinkNext VALUE=1
STATUS_LED color={COLOR}
{% else %}
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=blinkNext VALUE=0
_STATUS_LED color='off'
{% endif %}
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={printer["gcode_macro _STATUS_LED"].blink|float}