-
Notifications
You must be signed in to change notification settings - Fork 102
/
lcd.cfg
303 lines (275 loc) · 9.61 KB
/
lcd.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# Displays mini12864 LCD (Fystec)
[display]
lcd_type: uc1701
cs_pin: z:P1.18
a0_pin: z:P1.19
encoder_pins: ^z:P3.25,^z:P3.26
click_pin: ^!z:P0.28
contrast: 63
display_group: __voron_display
# Use either:
# __voron_main : that is a complete menu you need to [include display_menu.cfg] here.
# __voron_empty: only activates the backlight of the display for 10 sek if you
# hit the knob with no other function. In this case you can comment out
# [include display_menu.cfg]
# remove menu_root: ... if you want to use the stock menu
menu_root: __voron_empty
# Display menu definitions
[menu __voron_empty]
type: command
name: Main
gcode: {menu.exit()}
#[include display_menu.cfg]
[neopixel neo_display]
# Fystec 1 backlight 2/3 knob
# BTT 3 backlight 1/2 knob
# the macros here are written for Fystec if you use BTT you need to change the index
pin: z:P1.21
chain_count: 3
color_order: RGB
initial_RED: 0.8
initial_GREEN: 0.8
initial_BLUE: 1.0
[output_pin _BEEPER]
pin: z:P1.30
pwm: TRUE
value: 0
shutdown_value: 0
# PWM frequency : 0.001 = 1ms will give a base tone of 1kHz
cycle_time: 0.0024
# this solution is purly a workaround to switch on the display
# when pressing the menu button. It has the following limitaions:
# - As it is handled as normal gcode it can take a few sec to
# execute the gcode and light up
# - At blocking gcodes e.g M190 it will executed after that finished
# - You need to add 'UPDATE_DELAYED_GCODE ID=_DELAY_DISPLAY_OFF DURATION=10'
# manual to each menu item you execute with the menu.exit methode
# add this to use the click pin also to switch on display
[duplicate_pin_override]
pins: z:P0.28
[gcode_button click_button_display]
pin: ^!z:P0.28
press_gcode: {% if not printer.menu.running %} _DISPLAY_ON {% endif %}
release_gcode: {% if not printer.menu.running %} UPDATE_DELAYED_GCODE ID=_DELAY_DISPLAY_OFF DURATION=10 {% endif %}
# Glyph definition
[display_glyph chamber]
data:
0000000000000000
1111111111111111
1000010000100001
1000010000100001
1000011111100001
1000000000000001
1000000000000001
1000001111000001
1011101001011101
1000001111000001
1000000110000001
1000000000000001
1011111111111101
1000100000010001
1111111111111111
0000000000000000
[display_glyph voron]
data:
1111111001111111
1111100000011111
1111000000001111
1100000000000011
1000001100110001
1000011001100001
1000110011000001
1001100110000001
1000000110011001
1000001100110001
1000011001100001
1000110011000001
1110000000000111
1111000000001111
1111100000011111
1111111001111111
[display_glyph voroninv]
data:
0000001110000000
0000111111100000
0001111111110000
0111111111111100
1111100111001110
1111001110011110
1110011100111110
1100111001111110
1111110011100110
1111100111001110
1111001110011110
1110011100111110
0111111111111100
0001111111110000
0000111111100000
0000001110000000
# Display Data definition
[display_template _vheater_temperature]
param_heater: "extruder"
text:
{% if param_heater in printer %}
# Show glyph
{% if param_heater == "heater_bed" %}
{% if printer[param_heater].target %}
{% set frame = (printer.toolhead.estimated_print_time|int % 2) + 1 %}
~bed_heat{frame}~
{% else %}
~bed~
{% endif %}
{% else %}
~extruder~
{% endif %}
# Show temperature
{ "%3.0f" % (printer[param_heater].temperature,) }
# Optionally show target
{% if printer[param_heater].target and (printer[param_heater].temperature - printer[param_heater].target)|abs > 2 %}
~right_arrow~
{ "%0.0f" % (printer[param_heater].target,) }
{% endif %}
~degrees~
{% endif %}
[display_data __voron_display extruder]
position: 0, 0
text: { render("_vheater_temperature", param_heater="extruder") }
[display_data __voron_display fan]
position: 0, 10
text:
{% if 'fan' in printer %}
{% set speed = printer.fan.speed %}
{% if speed %}
{% set frame = (printer.toolhead.estimated_print_time|int % 2) + 1 %}
~fan{frame}~
{% else %}
~fan1~
{% endif %}
{ "{:>4.0%}".format(speed) }
{% endif %}
[display_data __voron_display bed]
position: 1, 0
text: { render("_vheater_temperature", param_heater="heater_bed") }
[display_data __voron_display progress_text]
position: 1, 10
text:
{% set progress = printer.virtual_sdcard.progress %}
{ "{:^6.0%}".format(progress) }
[display_data __voron_display progress_text2]
position: 1, 10
text:
{% set progress = printer.virtual_sdcard.progress %}
{ draw_progress_bar(1, 10, 6, progress) }
[display_data __voron_display chamber]
position: 2, 0
text:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% if 'chamber' in user.hw and user.hw.chamber.ena %}
~chamber~
{ "%3.0f" % printer["temperature_" + user.hw.chamber.type + " chamber"].temperature }
~degrees~
{% endif %}
[display_data __voron_display printing_time]
position: 2, 10
text:
{% set ptime = printer.print_stats.total_duration %}
{ "%02d:%02d" % (ptime // (60 * 60), (ptime // 60) % 60) }
[display_data __voron_display print_status]
position: 3, 0
text:
{% if printer.display_status.message %}
{ printer.display_status.message }
{% elif printer.idle_timeout.printing_time|int != 0 %}
{% set pos = printer.motion_report.live_position %}
{ "X%-4.0fY%-4.0fZ%-5.2f" % (pos.x, pos.y, pos.z) }
{% else %}
{ "V2.660 " }
~voroninv~
{% endif %}
# Macro definition
# M300 [P<ms>] [S<Hz>]
# P is the tone duration, S the tone frequency.
# The frequency won't be pitch perfect.
# Volume can be adjusted with VALUE. Maximum volume is VALUE=0.5 on the 12864.
[gcode_macro M300]
description: Set Beeper value
gcode:
{% set freq = params.S|default(440)|float %}
{% if freq != 0 %} SET_PIN PIN=_BEEPER VALUE=0.3 CYCLE_TIME={1/freq} {% endif %}
G4 P{params.P|default(100)|int}
SET_PIN PIN=_BEEPER VALUE=0
[delayed_gcode _DISPLAY_INIT]
gcode:
{% if printer['gcode_macro _USER_VARIABLE'].hw.display.ena %}
_LCD_KNOB COLOR=GREEN SYNC=1
UPDATE_DELAYED_GCODE ID=_DELAY_DISPLAY_OFF DURATION=10
{% endif %}
[gcode_macro _LCD_KNOB]
description: Helper: Set LCD Knob color
variable_knob: {'act' : {'pri':{'R':0.0, 'G':0.3, 'B':0.0},
'sec':{'R':0.0, 'G':0.0, 'B':0.0}},
'restore': {'pri':{'R':0.0, 'G':0.0, 'B':0.0},
'sec':{'R':0.0, 'G':0.0, 'B':0.0}},
'time' : 0,
'sync' : 0}
variable_select: 1 ; used to select what neopixel is active while blinking
gcode:
##### color definition #####
{% set color_dic = {'OFF' :{'R':0.0, 'G':0.0, 'B':0.0},
'GREEN':{'R':0.0, 'G':0.3, 'B':0.0},
'RED' :{'R':0.5, 'G':0.0, 'B':0.0},
'BLUE' :{'R':0.0, 'G':0.0, 'B':0.5}} %}
##### get PARAMETERS or use defaults values #####
{% set _dummy = knob.update({'time': params.BLINK|default(0)|float}) %}
{% set _dummy = knob.update({'sync': params.SYNC|default(0)|int}) %}
{% if 'COLOR' in params|upper %}
{% set color = params.COLOR|upper %}
{% set _dummy = knob.restore.update({'pri':knob.act.pri}) %}
{% if color in color_dic %}
{% set _dummy = knob.act.update({'pri':color_dic[color]}) %}
{% else %}
{action_respond_info("LCD KNOB COLOR %s is not defined used default: GREEN" % color)}
{% set _dummy = knob.act.update({'pri':color_dic.GREEN}) %}
{% endif %}
{% else %}
{% set _dummy = knob.act.update({'pri':knob.restore.pri}) %}
{% endif %}
##### store new variable values #####
SET_GCODE_VARIABLE MACRO=_LCD_KNOB VARIABLE=knob VALUE="{knob}"
##### update to new color and start or stop blinking #####
SET_LED LED=neo_display RED={knob.act.pri.R} GREEN={knob.act.pri.G} BLUE={knob.act.pri.B} INDEX=2 TRANSMIT=0 SYNC={knob.sync}
SET_LED LED=neo_display RED={knob.act.pri.R} GREEN={knob.act.pri.G} BLUE={knob.act.pri.B} INDEX=3 TRANSMIT=1 SYNC={knob.sync}
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={knob.time}
[delayed_gcode _BLINK_DELAY]
gcode:
{% set knob = printer["gcode_macro _LCD_KNOB"].knob %}
{% set i = [2,3] if printer["gcode_macro _LCD_KNOB"].select|int == 1 else [3,2] %}
SET_GCODE_VARIABLE MACRO=_LCD_KNOB VARIABLE=select VALUE={(printer["gcode_macro _LCD_KNOB"].select|int * -1)}
SET_LED LED=neo_display RED={knob.act.pri.R} GREEN={knob.act.pri.G} BLUE={knob.act.pri.B} INDEX={i[0]} TRANSMIT=0 SYNC={knob.sync}
SET_LED LED=neo_display RED={knob.act.sec.R} GREEN={knob.act.sec.G} BLUE={knob.act.sec.B} INDEX={i[1]} TRANSMIT=1 SYNC={knob.sync}
UPDATE_DELAYED_GCODE ID=_BLINK_DELAY DURATION={knob.time}
[gcode_macro DISPLAY]
description: Toggle Display backlight
variable_state: 'on'
gcode:
{% if state == 'on' %} _DISPLAY_OFF {% else %} _DISPLAY_ON {% endif %}
_DISPLAY_STATE
[gcode_macro _DISPLAY_STATE]
description: Helper: Print display backlight state
gcode: {action_respond_info("LCD display %s" % (printer["gcode_macro DISPLAY"].state))}
[gcode_macro _DISPLAY_OFF]
description: Helper: Display backlight off
gcode:
{% if not printer.menu.running and printer['gcode_macro _USER_VARIABLE'].hw.display.ena %}
SET_GCODE_VARIABLE MACRO=DISPLAY VARIABLE=state VALUE='"off"'
SET_LED LED=neo_display RED=0 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=1 SYNC=0
{% endif %}
[gcode_macro _DISPLAY_ON]
description: Helper: Display backlight on
gcode:
{% if printer['gcode_macro _USER_VARIABLE'].hw.display.ena %}
SET_GCODE_VARIABLE MACRO=DISPLAY VARIABLE=state VALUE='"on"'
SET_LED LED=neo_display RED=0.8 GREEN=0.8 BLUE=1.0 INDEX=1 TRANSMIT=1 SYNC=0
{% endif %}
[delayed_gcode _DELAY_DISPLAY_OFF]
gcode: _DISPLAY_OFF