My next question, is there a way to adapt this klipper macro to our set up?
Skip to content
Product
Solutions
Open Source
Pricing
Search
Sign in
Sign up
MapleLeafMakers
/
KlipperMacros
Public
Code
Issues
Pull requests
Actions
Projects
Security
Insights
KlipperMacros/temperature_color.cfg
@MapleLeafMakers
MapleLeafMakers Rename example delayed macro
Latest commit 93aff99 on Jul 4, 2022
History
1 contributor
165 lines (156 sloc) 4.82 KB
## Neopixel Temperature Indicator
# Source: https://github.com/MapleLeafMakers/KlipperMacros/
# Usage:
# To begin monitoring a temperature:
# SET_TEMPERATURE_LED LED=<led_name> [INDEX=<index>] [SENSOR=heater_bed] [COOL_TEMP=22] [HOT_TEMP=100] [BRIGHTNESS=1.0]
#
# To stop monitoring a temperature, and resume normal LED control
# CLEAR_TEMPERATURE_LED LED=<led_name> [INDEX=<index>]
#
# You can automate this by adding a delayed gcode macro to your printer.cfg, for example:
#
# [delayed_gcode set_temeperature_leds]
# initial_duration: 1
# gcode:
# SET_TEMPERATURE_LED LED=bed_light SENSOR=heater_bed
# SET_TEMPERATURE_LED LED=sb_leds INDEX=1 SENSOR=extruder
[gcode_macro SET_TEMPERATURE_LED]
description: Set one or more neopixels to track a temperature
gcode:
{% set sensor = params.SENSOR|default('heater_bed') %}
{% set cool_temp = params.COOL_TEMP|default(22.0)|float %}
{% set hot_temp = params.HOT_TEMP|default(100)|float %}
{% set brightness = params.BRIGHTNESS|default(1.0)|float %}
{% set led = params.LED %}
{% set index = params.INDEX %}
SET_LED_TEMPLATE LED={led}{% if index is defined %} INDEX={index}{% endif %} TEMPLATE=temperature_color param_sensor="'{sensor}'" param_cool_temp={cool_temp} param_hot_temp={hot_temp} param_brightness={brightness}
[gcode_macro CLEAR_TEMPERATURE_LED]
description: Set one or more neopixels to stop tracking a temperature and return to normal operation
gcode:
{% set led = params.LED %}
{% set index = params.INDEX %}
SET_LED_TEMPLATE LED={led}{% if index is defined %} INDEX={index}{% endif %} TEMPLATE=
[display_template temperature_color]
param_cool_temp: 22
param_hot_temp: 100
param_sensor: 'heater_bed'
param_brightness: 1.0
param_gradient: [
(0.04,0.04,1.00,0.00),
(0.04,0.04,1.00,0.00),
(0.04,0.04,1.00,0.00),
(0.04,0.04,1.00,0.00),
(0.04,0.04,1.00,0.00),
(0.05,0.04,1.00,0.00),
(0.05,0.05,1.00,0.00),
(0.06,0.06,1.00,0.00),
(0.07,0.07,1.00,0.00),
(0.08,0.08,1.00,0.00),
(0.09,0.10,1.00,0.00),
(0.11,0.12,1.00,0.00),
(0.13,0.13,1.00,0.00),
(0.15,0.15,1.00,0.00),
(0.16,0.17,0.99,0.00),
(0.18,0.19,0.99,0.00),
(0.20,0.21,0.99,0.00),
(0.23,0.23,0.99,0.00),
(0.25,0.25,0.98,0.00),
(0.27,0.27,0.98,0.00),
(0.29,0.31,0.98,0.00),
(0.31,0.42,0.96,0.00),
(0.31,0.50,0.94,0.00),
(0.31,0.57,0.92,0.00),
(0.31,0.63,0.89,0.00),
(0.31,0.69,0.86,0.00),
(0.31,0.74,0.84,0.00),
(0.30,0.78,0.80,0.00),
(0.29,0.82,0.76,0.00),
(0.27,0.86,0.72,0.00),
(0.25,0.89,0.66,0.00),
(0.23,0.93,0.58,0.00),
(0.20,0.96,0.50,0.00),
(0.16,0.98,0.41,0.00),
(0.13,0.99,0.33,0.00),
(0.09,1.00,0.25,0.00),
(0.07,1.00,0.14,0.00),
(0.08,1.00,0.20,0.00),
(0.07,1.00,0.24,0.00),
(0.08,1.00,0.25,0.00),
(0.11,1.00,0.23,0.00),
(0.10,1.00,0.18,0.00),
(0.09,1.00,0.14,0.00),
(0.18,1.00,0.22,0.00),
(0.27,0.99,0.25,0.00),
(0.36,0.98,0.28,0.00),
(0.45,0.97,0.29,0.00),
(0.53,0.96,0.29,0.00),
(0.62,0.94,0.27,0.00),
(0.71,0.92,0.23,0.00),
(0.79,0.90,0.16,0.00),
(0.86,0.88,0.10,0.00),
(0.91,0.86,0.20,0.00),
(0.95,0.84,0.25,0.00),
(0.98,0.82,0.27,0.00),
(0.98,0.82,0.27,0.00),
(0.98,0.82,0.24,0.00),
(0.99,0.82,0.16,0.00),
(1.00,0.82,0.15,0.00),
(1.00,0.82,0.13,0.00),
(1.00,0.82,0.10,0.00),
(1.00,0.83,0.06,0.00),
(1.00,0.83,0.03,0.00),
(1.00,0.82,0.09,0.00),
(1.00,0.81,0.12,0.00),
(1.00,0.80,0.14,0.00),
(1.00,0.80,0.16,0.00),
(1.00,0.78,0.17,0.00),
(1.00,0.77,0.18,0.00),
(1.00,0.76,0.18,0.00),
(1.00,0.75,0.19,0.00),
(1.00,0.74,0.19,0.00),
(1.00,0.72,0.20,0.00),
(1.00,0.71,0.20,0.00),
(1.00,0.69,0.20,0.00),
(1.00,0.68,0.20,0.00),
(1.00,0.66,0.20,0.00),
(1.00,0.64,0.20,0.00),
(1.00,0.62,0.19,0.00),
(1.00,0.60,0.18,0.00),
(1.00,0.57,0.16,0.00),
(1.00,0.54,0.15,0.00),
(1.00,0.51,0.14,0.00),
(1.00,0.47,0.13,0.00),
(1.00,0.43,0.11,0.00),
(1.00,0.39,0.10,0.00),
(1.00,0.37,0.08,0.00),
(1.00,0.36,0.06,0.00),
(1.00,0.33,0.05,0.00),
(1.00,0.31,0.04,0.00),
(1.00,0.29,0.02,0.00),
(1.00,0.27,0.02,0.00),
(1.00,0.26,0.01,0.00),
(1.00,0.24,0.01,0.00),
(1.00,0.22,0.00,0.00),
(1.00,0.20,0.00,0.00),
(1.00,0.18,0.00,0.00),
(1.00,0.16,0.00,0.00),
(1.00,0.15,0.00,0.00),
(1.00,0.13,0.00,0.00),
(1.00,0.11,0.00,0.00),
(1.00,0.09,0.00,0.00),
(1.00,0.07,0.00,0.00),
(1.00,0.05,0.00,0.00),
(1.00,0.04,0.00,0.00),
(1.00,0.02,0.00,0.00),
(1.00,0.01,0.00,0.00),
(1.00,0.00,0.00,0.00)]
text:
{% set temp = printer[param_sensor].temperature %}
{% set steps = param_gradient|length %}
{% set idx = (((temp - param_cool_temp) / (param_hot_temp - param_cool_temp)) * steps) | int %}
{% if idx < 0 %}
{% set idx = 0 %}
{% elif idx > steps-1 %}
{% set idx = steps-1 %}
{% endif %}
{ param_gradient[idx][0] * param_brightness },{ param_gradient[idx][1] * param_brightness },{ param_gradient[idx][2] * param_brightness },{ param_gradient[idx][3] * param_brightness }
Footer
© 2023 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
KlipperMacros/temperature_color.cfg at main · MapleLeafMakers/KlipperMacros · GitHub