-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled_progress.cfg
124 lines (110 loc) · 4.05 KB
/
led_progress.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
# use NEOPIXEL_DISPLAY LED="Led_Name" TYPE=template_type MODE=template_mode
# for TYPE use:
# extruder_temp :extruder temperature progress
# bed_temp :bed temperature progress
# print_percent :print progress
# printer_speed :printer speed
# clear :will clear any previous template assigned to the LED
# for MODE use:
# progress :the leds will light up one by one
# glow :all leds will fade from one color (or non) to other color
# more info: https://github.com/digitalninja-ro/klipper-neopixel/blob/master/README.md
[gcode_macro NEOPIXEL_DISPLAY]
gcode:
{% set led = params.LED %}
{% set type = params.TYPE %}
{% set mode = params.MODE %}
{% set my_neopixel = printer.configfile.settings['neopixel ' ~ led|lower] %}
{% if type == 'clear' %}
SET_LED_TEMPLATE LED={led} TEMPLATE=""
SET_LED LED={led} RED=0 GREEN=0 BLUE=0
{% else %}
{% if mode == 'progress' %}
{% for i in range(my_neopixel.chain_count) %}
SET_LED_TEMPLATE LED={led} INDEX={i+1} TEMPLATE={'led_' ~ type ~ '_' ~ mode} param_led_num={i+1} param_led_total={my_neopixel.chain_count}
{% endfor %}
{% endif %}
{% if mode == 'glow' %}
SET_LED_TEMPLATE LED={led} TEMPLATE={'led_' ~ type ~ '_' ~ mode}
{% endif %}
{% endif %}
[display_template led_extruder_temp_glow]
text:
{% if printer.extruder.target > 0.0 %}
{% set temp = printer.extruder.target %}
{% else %}
{% set temp = printer.configfile.settings.extruder.max_temp %}
{% endif %}
{% set ratio = printer.extruder.temperature / temp %}
{ratio}, 0.0, {1-ratio}, 0.0
[display_template led_extruder_temp_progress]
param_led_num: 0
param_led_total: 1
text:
{% if printer.extruder.target > 0.0 %}
{% set temp = printer.extruder.target %}
{% else %}
{% set temp = printer.configfile.settings.extruder.max_temp %}
{% endif %}
{% set ratio = printer.extruder.temperature / temp %}
{% set led_ratio = param_led_num|float / param_led_total %}
{% if ratio > led_ratio %}
{led_ratio}, 0.0, 0.0, 0.0
{% else %}
0.0, 0.0, 0.0, 0.0
{% endif %}
[display_template led_bed_temp_glow]
text:
{% if printer.heater_bed.target > 0.0 %}
{% set temp = printer.heater_bed.target %}
{% else %}
{% set temp = printer.configfile.settings.heater_bed.max_temp %}
{% endif %}
{% set ratio = printer.heater_bed.temperature / temp %}
{ratio}, 0.0, {1-ratio}, 0.0
[display_template led_bed_temp_progress]
param_led_num: 0
param_led_total: 1
text:
{% if printer.heater_bed.target > 0.0 %}
{% set temp = printer.heater_bed.target %}
{% else %}
{% set temp = printer.configfile.settings.heater_bed.max_temp %}
{% endif %}
{% set ratio = printer.heater_bed.temperature / temp %}
{% set led_ratio = param_led_num|float / param_led_total %}
{% if ratio > led_ratio %}
{led_ratio}, 0.0, 0.0, 0.0
{% else %}
0.0, 0.0, 0.0, 0.0
{% endif %}
[display_template led_print_percent_glow]
text:
{% set ratio = printer.virtual_sdcard.progress %}
0.0, {ratio}, 0.0, 0.0
[display_template led_print_percent_progress]
param_led_num: 0
param_led_total: 1
text:
{% set ratio = printer.virtual_sdcard.progress %}
{% set led_ratio = param_led_num|float / param_led_total %}
{% if ratio > led_ratio %}
0.0, {led_ratio}, 0.0, 0.0
{% else %}
0.0, 0.0, 0.0, 0.0
{% endif %}
[display_template led_printer_speed_glow]
text:
{% set ratio = printer.motion_report.live_velocity / printer.configfile.settings.printer.max_velocity %}
0.0, {ratio}, 0.0, 0.0
[display_template led_printer_speed_progress]
param_led_num: 0
param_led_total: 1
text:
{% set ratio = printer.motion_report.live_velocity / printer.configfile.settings.printer.max_velocity %}
{% set led_ratio = param_led_num|float / param_led_total %}
{% if ratio > led_ratio %}
0.0, {led_ratio}, 0.0, 0.0
{% else %}
0.0, 0.0, 0.0, 0.0
{% endif %}