stealthmonkey99 / OctoPrint-PWMBuzzer

M300 gcode handler (PWM buzzer via GPIO) for OctoPrint
6 stars 1 forks source link

Prevent M300 from going to printer #8

Closed andritolion closed 2 years ago

andritolion commented 2 years ago

I was planning to use this plugin as a better replacement for the beeper built-in to my printer, the Ender 3 v2. Its buzzer can only be run at one frequency, and I was hoping that this plugin would serve as a replacement. However, both my printer and my Pi make a buzzing sound for M300 commands, and my printer's LCD beep is very unpleasant. Could an option be added to prevent M300 commands from being sent to the printer?

stealthmonkey99 commented 2 years ago

Sure thing, great idea - PR #9 should allow for this now. @andritolion can you try installing the plugin from https://github.com/stealthmonkey99/OctoPrint-PWMBuzzer/archive/suppress-m300.zip to test it out? If it works as expected and suppresses the tones on your printer, I'll merge it in for the next release :)

andritolion commented 2 years ago

Perfect! Works like a charm. Thanks! Now I can hear my beeper without having to remove my screen. Say, I was wondering, what exactly does the duty cycle setting change? I hear a difference in pitch between percentages, but is that all? IMO, this should be communicated in the setting menu. Additionally, do you have any suggestions for some loud piezo buzzers? I'm using some cheap PC speakers from Amazon, but I was wondering if you have any louder suggestions. It's simply not as loud as my screen, which you can hear from across the house, lol.

stealthmonkey99 commented 2 years ago

🎉 Great to hear, thanks for testing it out for me!

RE: Duty cycle... PWM applies an electrical signal on-and-off repeatedly, and the duty cycle describes how long the signal is "on" per each repetition. The wikipedia article has some helpful diagrams to explain it better than I could: https://en.wikipedia.org/wiki/Pulse-width_modulation#Duty_cycle but ultimately it's going to make your buzzer sound slightly different at 50% vs. a lower percentage. For one of my buzzers, it's more "smooth" sounding with a square wave at 50% (equal duration of time on vs. off) and it gets a little "buzzier" closer to 30%. For another buzzer I have, the value doesn't seem to affect the sound quality much at all. I might move this under "advanced settings" and add a little note that it may have little effect.

RE: buzzers to use... Neither of mine are super loud so these might not be any better than what you have: