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.
I had a problem with volume control. I think it was because SD card is not a fast enough. And writing settings are executes synchrony. I tryed to move it into another thread.
How it works:
When settings changed we are start writing to SD card asynchrony instead of synchrony. If new changes try to run cycle again it will be delayed until thread not finished.
Then settings will be writen one more time. It can be not a thread safe, when main thread re-write settings variables and the second thread try to read them for store to SD card.
In all cases, even if writen to SD card settigns will be changed in "writing" moment, it will be re-writen one more time.
Video how it works before with slow SD card and how it works after moving saving settings to thread:
https://www.youtube.com/watch?v=fIy-bYyZLBk