My solution to solve the watchdog issues with custom sound generation#3310
My solution to solve the watchdog issues with custom sound generation#3310bmuessig wants to merge 7 commits into
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.
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.
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 👍
|
|
||
| // 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.
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.
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_alivethat doesn't update the LCD for long delays that exceed 1.1 seconds.