-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tone generation for ESP32 #20704
Add tone generation for ESP32 #20704
Conversation
And more sensible speed values
Yay M300, now we have some tunes! Still kinda wurbly because i have no idea what i'm doing.
If the amplitude is irregular, then possibly there's less current to the speaker during certain activities, but most boards should have that pretty well isolated. But if the frequency is uneven, we can try boosting the timer priority (or choosing a timer index with a naturally higher priority) to see if that helps. I'm not sure exactly where to make that change… yet. Note that currently our ESP32 implementation of |
Ah, TOGGLE is nice, missed that. |
So I just saw this MR. Using timers in the ESP32 works okay but the number of interrupts can cause issues with the WiFi (or vice versa depending in the priorities). I think the tone generation should have been done with the ledc code (like PWM) to use the hardware to generate the tone. I think using the api |
Yep, it's just a quick and dirty copypaste, i never expected it to be good. But i made it like that so i could use i2s, and it kinda works. I will use 555 to make pulse lenghts actually usable for sound and report back. |
Sorry I haven't been trying out the latest changes to Marlin bugfix. Didn't realize that the tone generation uses I2S. Will this affect the I2S stepper stream? If it affects I2S stepper stream, the ledc idea may be a more compatible solution that doesn't conflict with I2S or Wifi. |
Who knows? I need to get it printing first, to see if anything affected. Then again, it won't really play tunes while actually printing and menu beeps may be not sufficient for testing. |
So I don't think using I2S for the tone generation is the right thing to do (it will require a software pulse generator for this to happen). Just using the ledc driver and a normal GPIO is the best approach I think. I might have a look at some point but I've never used a buzzer on any of my controllers so this hasn't been very high prio |
Description
Add tone generation for ESP32.
Bump up platform version, becuse why not? It looks like nothing's broken.
Someone who actually have an idea how it all works, please check.
Benefits
#define SPEAKER now works
Yay M300 we have cool tunes!