-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.cfg
83 lines (72 loc) · 2.04 KB
/
screen.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
[menu __main __octoprint]
type: disabled
[display]
lcd_type: uc1701
cs_pin: PB9
a0_pin: PB8
rst_pin: PD6
encoder_pins: ^PB5,^PA15
click_pin: ^!PA10
contrast: 63
spi_software_sclk_pin: PA5
spi_software_mosi_pin: PA7
spi_software_miso_pin: PA6
[pwm_cycle_time beeper]
pin: PD5
value: 0
shutdown_value: 0
cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)
[neopixel btt_mini12864]
pin: PA9
chain_count: 3
color_order: RGB
initial_RED: 0.0
initial_GREEN: 0.2
initial_BLUE: 0.8
[delayed_gcode welcome1]
initial_duration: 1
gcode:
M117 Hello!
[delayed_gcode welcome2]
initial_duration: 2.5
gcode:
M117 Ready to make!
### M300 P2000 S2000 ####
[gcode_macro m300]
description: Emits an audible beep.
Usage: M300 [P<duration>] [S<frequency>]
gcode:
{% set settings = printer.configfile.settings %}
{% if "output_pin beeper" in printer or "pwm_cycle_time beeper" in printer %}
{% set P = (params.P|default(100)|int, 0)|max %}
{% set S = (params.S|default(1000)|int, 0)|max %}
{% if S == 0 %}
G4 P{P}
{% else %}
SET_PIN PIN=beeper VALUE={% if "output_pin beeper" in settings %}1{%else%}{
settings["pwm_cycle_time beeper"].scale|default(1.0) * 0.3
} CYCLE_TIME={ 1.0 / S }
G4 P{P}
SET_PIN PIN=beeper VALUE=0
{% endif %}
{% endif %}
{% else %}
{action_respond_info(
"M300 is disabled. To enable, create a [pwm_cycle_time beeper] config.")}
{% endif %}
#### Beep Macro ####
[gcode_macro BEEP]
gcode:
# Parameters
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
{% set freq = params.FREQ|default(2000)|int %} ; Frequency in Hz. Default 2kHz.
{% for iteration in range(i|int) %}
{% if freq == 0 %}
G4 P{dur}
{% else %}
SET_PIN PIN=beeper VALUE=0.5 CYCLE_TIME={ 1.0/freq }
G4 P{dur}
SET_PIN PIN=beeper VALUE=0
{% endif %}
{% endfor %}