-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
My solution to solve the watchdog issues with custom sound generation #3310
base: MK3
Are you sure you want to change the base?
Conversation
In order to create a headless version that can be used as a substitute for very long delays.
Having hit PR number 3310 in a sound-related PR, the classic Nokia 3310 ringtone came to mind: https://www.youtube.com/watch?v=h6iIFVTwKeE |
// Waits for the duration and uses the most appropriate delay type | ||
void Sound_Delay(uint16_t ms) | ||
{ | ||
if (ms < (SOUND_KEEPALIVE_MIN_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.
Not sure if doing something like this is really needed. You could just use delay_keep_alive(noUIupdates) regardless of duration. As long as no sounds are generated, delay_keep_alive() is just fine at all times, with the added bonus of managed heaters and inactivity messages on uart so that the host doesn't time out.
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 was not sure how much delay the update routine adds (which might also vary), so I thought it would make sense to keep the length of short beeps more accurate. But if this is not required, this could be simplified indeed 👍
@@ -13,6 +13,9 @@ typedef enum | |||
typedef enum | |||
{e_SOUND_CLASS_Echo,e_SOUND_CLASS_Prompt,e_SOUND_CLASS_Confirm,e_SOUND_CLASS_Warning,e_SOUND_CLASS_Alert} eSOUND_CLASS; | |||
|
|||
// The minimum number of milliseconds of sound duration, to use the keep-alive method instead of the default delay | |||
// This is used to allow the printer to retain control in long-running sound output | |||
#define SOUND_KEEPALIVE_MIN_MS 1100 |
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.
Not really relevant considering the points above, but just a quick observation:
Instead of doing if (delay < 1100) delay(); else delay_keep_alive();
, do if (delay > 1000) delay_keep_alive(); else delay();
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 just choose 1100 ms to exclude one second long beeps, but I added 100 ms in case someone somewhere used a delay around 1 second, but not exactly.
Alright, I have now combined the multiple methods into one with the second optional parameter controlling whether to update the LCD. Now, what's the best minimum threshold to trigger |
I'll look at the updated PR soonTM (maybe tomorrow). In the meantime, here is a gcode with music: I think |
As discussed issue #2045, long sound durations often cause the watchdog timer to reset the printer, as the sound generation is currently using regular delays that don't feed the watchdog timer.
I am proposing a hybrid solution that uses regular delays for short beeps and a modified version of
delay_keep_alive
that doesn't update the LCD for long delays that exceed 1.1 seconds.