Further work on the neopixel caselight
This commit is contained in:
parent
982bf5c817
commit
92a833eb6b
|
|
@ -15,7 +15,9 @@ initial_WHITE: 0.1
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# Macros
|
# Macros
|
||||||
#####################################################################
|
#####################################################################
|
||||||
[gcode_macro _VAR_LEDS]
|
|
||||||
|
[gcode_macro _CASELIGHT]
|
||||||
|
default_parameter_COLOR: 'white'
|
||||||
variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
|
variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
|
||||||
'orange': (1.0, 0.5, 0.0, 0.0),
|
'orange': (1.0, 0.5, 0.0, 0.0),
|
||||||
'yellow': (1.0, 1.0, 0.0, 0.0),
|
'yellow': (1.0, 1.0, 0.0, 0.0),
|
||||||
|
|
@ -33,29 +35,22 @@ variable_colors: { 'red': (1.0, 0.0, 0.0, 0.0),
|
||||||
'raspberry': (1.0, 0.0, 0.5, 0.0),
|
'raspberry': (1.0, 0.0, 0.5, 0.0),
|
||||||
'rose': (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),
|
'white': (0.0, 0.0, 0.0, 4.0),
|
||||||
'off': (0.0, 0.0, 0.0, 0.0)}
|
'off': (0.0, 0.0, 0.0, 0.0) }
|
||||||
gcode:
|
variable_leds: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
|
||||||
|
|
||||||
[gcode_macro _SET_LEDS]
|
|
||||||
default_parameter_color: 'WHITE'
|
|
||||||
default_parameter_index: (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
|
|
||||||
gcode:
|
gcode:
|
||||||
# Grab the color values
|
# Grab the color values
|
||||||
{% set R=printer["gcode_macro _VAR_LEDS"].colors.[params.COLOR][0] %}
|
{% set tuple = colors.get(COLOR|lower, (0.0, 0.0, 0.0, 0.7)) %}
|
||||||
{% set G=printer["gcode_macro _VAR_LEDS"].colors.[params.COLOR][1] %}
|
{% set R = tuple[0] %}
|
||||||
{% set B=printer["gcode_macro _VAR_LEDS"].colors.[params.COLOR][2] %}
|
{% set G = tuple[1] %}
|
||||||
{% set W=printer["gcode_macro _VAR_LEDS"].colors.[params.COLOR][3] %}
|
{% set B = tuple[2] %}
|
||||||
|
{% set W = tuple[3] %}
|
||||||
|
|
||||||
{% for I in index %}
|
{action_respond_info("LED Tuple: {0}".format(tuple))}
|
||||||
SET_LED LED=neo_leds RED={R} GREEN={G} BLUE={B} WHITE={W} INDEX={I} TRANSMIT={{ loop.last }} SYNC=0
|
|
||||||
|
{% 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 %}
|
{% endfor %}
|
||||||
|
|
||||||
[gcode_macro _CASELIGHT]
|
|
||||||
default_parameter_COLOR: 'WHITE'
|
|
||||||
variable_index: (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
|
|
||||||
gcode:
|
|
||||||
_SET_LED color={COLOR} index={var_index}
|
|
||||||
|
|
||||||
[gcode_macro _caselight_state]
|
[gcode_macro _caselight_state]
|
||||||
gcode:
|
gcode:
|
||||||
{action_respond_info("Caselight %s" % (printer["gcode_macro CASELIGHT"].state))}
|
{action_respond_info("Caselight %s" % (printer["gcode_macro CASELIGHT"].state))}
|
||||||
|
|
@ -73,9 +68,9 @@ gcode:
|
||||||
_caselight_state
|
_caselight_state
|
||||||
|
|
||||||
[gcode_macro CASELIGHT]
|
[gcode_macro CASELIGHT]
|
||||||
variable_state: 'off'
|
variable_state: 'on'
|
||||||
gcode:
|
gcode:
|
||||||
{%if printer['output_pin _caselight'].value == 0 %}
|
{%if printer['gcode_macro CASELIGHT'].state == "off" %}
|
||||||
_CASELIGHT_ON
|
_CASELIGHT_ON
|
||||||
{% else %}
|
{% else %}
|
||||||
_CASELIGHT_OFF
|
_CASELIGHT_OFF
|
||||||
|
|
@ -91,6 +86,7 @@ default_parameter_BLINK: 0
|
||||||
variable_color: 'ORANGE'
|
variable_color: 'ORANGE'
|
||||||
variable_restore: 'GREEN'
|
variable_restore: 'GREEN'
|
||||||
variable_index: 17
|
variable_index: 17
|
||||||
|
variable_blink: 0
|
||||||
variable_blinkNext: 0
|
variable_blinkNext: 0
|
||||||
gcode:
|
gcode:
|
||||||
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
|
{% set var_color=printer["gcode_macro _STATUS_LED"].color %}
|
||||||
|
|
@ -99,9 +95,9 @@ gcode:
|
||||||
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={BLINK|float}
|
UPDATE_DELAYED_GCODE ID=_STATUS_LED_BLINK_DELAY DURATION={BLINK|float}
|
||||||
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=restore VALUE='"{var_color}"'
|
SET_GCODE_VARIABLE MACRO=_STATUS_LED VARIABLE=restore VALUE='"{var_color}"'
|
||||||
{% if params.COLOR %}
|
{% if params.COLOR %}
|
||||||
_SET_LED color={COLOR} index={var_index}
|
#_SET_LEDS color={COLOR} index={var_index}
|
||||||
{% else %}
|
{% else %}
|
||||||
_SET_LED color={var_restore} index={var_index}
|
#_SET_LEDS color={var_restore} index={var_index}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[delayed_gcode _STATUS_LED_BLINK_DELAY]
|
[delayed_gcode _STATUS_LED_BLINK_DELAY]
|
||||||
|
|
@ -117,3 +113,4 @@ gcode:
|
||||||
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={printer["gcode_macro _STATUS_LED"].blink|float}
|
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={printer["gcode_macro _STATUS_LED"].blink|float}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue