Double beep for non-existent channel, refactoring channel change #178
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.
During use, I noticed that the existence of the channel is checked every time a digit is entered. For example, suppose we have channel 35 stored, but channel 3 is empty. Entering the digit 3 will trigger a beep indicating that there is no channel 3 even though our intention is not to go to channel 3. The timeout is still in progress, so pressing 5 will go to channel 35 which exists. I have made the beep appear after the timeout has stopped (for one-digit and two-digit numbers). The problem does not appear with three-digit numbers, because there is no timeout there.
I also managed to save 8 bytes, but it works the same as before.
Modified code: 6820b0a