Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After building the audio-guestbook and using it on a wedding for the first time, I came across an issue: If you put the hook back, while the beep before the recording is played, the hook press is not recognized. The problem is: while in the
wait()
-function, button presses are recognized, but not communicated to outside ofwait()
.I found some issues for this problem, but was not convinced of the solutions (max recording time 120seconds), so I made this one.
I made
wait()
returnboolean
instead ofvoid
. If therecordButton
is pressed, the hook is back on it (raising/falling edge still need to be checked for your specific telephone). If the hook is back on, thewait()
-function is interrupted and returnsfalse
. Ifwait()
was able to run through, it returnstrue
.Before starting the record, it's checked if
wait()
is running through without interrupts (returningtrue
). If so, start recording. Ifwait()
is interrupted and returnsfalse
, immediately stop the beep and get into modeReady
.