forked from NARUTOfzr/klipper-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
beep.cfg
21 lines (21 loc) · 797 Bytes
/
beep.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (C) 2022 Justin Schuh <[email protected]>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
[gcode_macro m300]
description: Emits and audible beep.
Usage: M300 [P<duration>] [S<frequency>]
gcode:
{% set settings = printer.configfile.settings %}
{% if "output_pin beeper" in printer %}
{% set P = (params.P|default(100)|int, 0)|max %}
{% set S = (params.S|default(1000)|int, 1)|max %}
SET_PIN PIN=beeper VALUE={
settings["output_pin beeper"].scale|default(1.0) * 0.5
}{% if settings["output_pin beeper"].pwm %} CYCLE_TIME={
1.0 / S }{% endif %}
G4 P{P}
SET_PIN PIN=beeper VALUE=0
{% else %}
{action_respond_info(
"M300 is disabled. To enable create an [output_pin beeper] config.")}
{% endif %}