fryc88 / klipper-sv06plus-screen

Modified screen firmware files for Sovol SV06 Plus and stock screen to use with Klipper
81 stars 4 forks source link

How to enable klipper beep #10

Open frostius opened 10 months ago

frostius commented 10 months ago

I've got the screen flashed and running but was not able to get beeping to work from mainsail. I've enabled the beeper section of printer.cfg, but that didn't seem to work. What am I missing?

[output_pin beeper]
pin: PC6
value: 0
shutdown_value: 0
pwm: True
cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)
fryc88 commented 10 months ago

This way it won't work because there's no pin for buzzer. As far as I remember there was command to send to screen to buzz, m something, if I won't forget I'll try to find it. Pin definition as in your post works only with "standard" screens

On Mon, 20 Nov 2023 at 14:49, Matt Frost @.***> wrote:

I've got the screen flashed and running but was not able to get beeping to work from mainsail. I've enabled the beeper section of printer.cfg, but that didn't seem to work. What am I missing?

[output_pin beeper] pin: PC6 value: 0 shutdown_value: 0 pwm: True cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)

— Reply to this email directly, view it on GitHub https://github.com/fryc88/klipper-sv06plus-screen/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB23JB2KWUSWF2IKA4CGRLYFNUY7AVCNFSM6AAAAAA7TBJTW2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDEMZXGI3DSMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

frostius commented 10 months ago

From DGUS github site, "Playing sounds using M300 (the frequency parameter is the index of the audio file)". I don't see any additional information such as the supported audio formats and if frequency is supported in some other way.

frostius commented 10 months ago

For anyone else trying to get klipper to beep, the gcode M300 works. My sovol sv06+ appears to only have a buzzer in it so frequency is ignored. Also, there is a limitation of a max duration of 255.

ihatemyisp commented 9 months ago

For anyone else trying to get klipper to beep, the gcode M300 works. My sovol sv06+ appears to only have a buzzer in it so frequency is ignored. Also, there is a limitation of a max duration of 255.

Did you have to change any of the beep section settings? I can't get mine to beep.

frostius commented 9 months ago

You can call M300 directly and it should work. That said, the macros that are part of the bassamanator mainsail repo call the BEEP macro. You'll need to update that macro (in file ``/cfg/misc-macros.cfg) so it calls M300 instead of setting a pin.

Below is my modified version


[gcode_macro BEEP]
description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency.
gcode:
    # Parameters
    {% set i = params.I|default(1)|int %}           ; Iterations (number of times to beep).
    {% set dur = [params.DUR|default(100)|int,255] | min %}     ; Duration/wait of each beep in ms. Default 100ms.
    ;{% set freq = params.FREQ|default(2000)|int %}  ; Frequency in Hz. Default 2kHz, not supported sv06+

    {% for iteration in range(i|int) %}
        M300 P{dur} 
        G4 P{dur}
    {% endfor %}
ihatemyisp commented 9 months ago

@frostius Thanks, works perfectly

fryc88 commented 9 months ago

[gcode_macro BEEP] description: BEEP I=3 DUR=200 FREQ=2000: Beep 3 times, for 200ms each, at 2kHz frequency. gcode:

Parameters

{% set i = params.I|default(1)|int %}           ; Iterations (number of times to beep).
{% set dur = [params.DUR|default(100)|int,255] | min %}     ; Duration/wait of each beep in ms. Default 100ms.
;{% set freq = params.FREQ|default(2000)|int %}  ; Frequency in Hz. Default 2kHz, not supported sv06+

{% for iteration in range(i|int) %}
    M300 P{dur} 
    G4 P{dur}
{% endfor %}

I've added you macro to main readme file, I hope you don't mind since you've shared it here. Thanks