-
-
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
Improvement to non-blocking speaker #4456
Conversation
That's exactly what i feared. You are occupying a timer and an interrupt. |
uint16_t duration; | ||
uint16_t frequency; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A struct is not an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to create a new tone_t.h
.
@Blue-Marlin for your pleasure: https://www.youtube.com/watch?v=tsKZx0vHJ2o |
You're wrong, What is the difference between a timer and an interrupt you may ask..
|
The event is the timer overflow. |
Exactly, that's what I wrote. |
No. You claimed a timer interrupt not to be an interrupt. |
Let's leave that. It's a bit unproductive. There are bigger problems we should care about. No tone() please - is all what i want for now. |
No I claimed this:
|
The first is an interrupt based on a counter (overflow, apparently), while the second is every type of interrupt (including timer interrupts). All salmon are fish, but not all fish are salmon. All "timers" (in this sense) are interrupts, but not all interrupts are timers.
Such as a counter overflow or a pin state change. When it's a counter overflow, we call it a "timer." They both interrupt the flow of execution. (Although I suppose it's possible with some CPUs to have a counter overflow just set a bit that you can check later, and not call any interrupt.) |
@@ -23,7 +23,7 @@ | |||
#include "Marlin.h" | |||
#include "temperature.h" | |||
|
|||
void safe_delay(uint16_t ms) { | |||
void safe_delay(uint32_t ms) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
millis_t
would also be appropriate here.
If |
The starting point for the discussion was @Blue-Marlin's
Which implies Let's be pragmatic and down to earth: It does not fucking matter. The main objective of the buzzer is to emit sound feedback when people are navigating on the menu system; some people might want it to buzz when their print finish, others would prefer to play the Pokemon theme instead. Why it doesn't matter are you still asking ? Because the Pokemon theme will be played when the printer is idle, not when it's printing. The best thing the printer has to do is to play the fucking Pokemon theme as it as been requested to do. I don't care if we use the exiting code or the |
Tone() was in the sound code at least twice. It was removed always after a short time, because of various problems. Our issue history is so full of buzzer, beeper, speaker, tone(), lcd.buzz(), lcd_buzz(), buzzer.h problems, that i currently can't find the relevant ones. Butt during the last 18 month always someone from KiteLab was involved. I'm soooooooooooo tired about it. |
Please, let me show you why |
The beginning was #3913
.
Clear answers: |
c78514c
to
c52c813
Compare
I'm happy with a tone that sounds better, and you're right that we don't care about long tones or long queues of tones playing during a print. And non-blocking is of course preferred in any case. Mainly I hope we make a positive impression on users, because in this instance user perception is what matters. |
Update enabled diacritics
Non-blocking speaker now uses Arduino's
tone()
function.Here is a comparison between all the possible three impementations for speaker.
https://www.youtube.com/watch?v=tsKZx0vHJ2o