-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemperature_color.cfg
165 lines (156 loc) · 4.82 KB
/
temperature_color.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
## 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 }