-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathled_progress.cfg
117 lines (104 loc) · 3.83 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
# 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
# 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.config['neopixel ' ~ led] %}
{% if mode == 'progress' %}
{% for i in range(my_neopixel.chain_count|int) %}
SET_LED_TEMPLATE LED={led} INDEX={i+1} TEMPLATE={'led_' ~ type ~ '_' ~ mode} param_led_num={i+1} param_led_total={my_neopixel.chain_count|int}
{% endfor %}
{% endif %}
{% if mode == 'glow' %}
SET_LED_TEMPLATE LED={led} TEMPLATE={'led_' ~ type ~ '_' ~ mode}
{% endif %}
[display_template led_extruder_temp_glow]
text:
{% if printer.extruder.target > 0.0 %}
{% set temp = printer.extruder.target %}
{% else %}
{% set temp = printer.configfile.config.extruder.max_temp %}
{% endif %}
{% set ratio = printer.extruder.temperature / temp|float %}
{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.config.extruder.max_temp %}
{% endif %}
{% set ratio = printer.extruder.temperature / temp|float %}
{% 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.config.heater_bed.max_temp %}
{% endif %}
{% set ratio = printer.heater_bed.temperature / temp|float %}
{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.config.heater_bed.max_temp %}
{% endif %}
{% set ratio = printer.heater_bed.temperature / temp|float %}
{% 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|float / printer.configfile.config.printer.max_velocity|float %}
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|float / printer.configfile.config.printer.max_velocity|float %}
{% 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 %}