Skip to content
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

Move writing settings to thread. #1488

Merged
merged 3 commits into from
May 9, 2024
Merged

Move writing settings to thread. #1488

merged 3 commits into from
May 9, 2024

Conversation

hypercyclist
Copy link
Contributor

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

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.
@Aemiii91 Aemiii91 added the bug in onion Something isn't working label Mar 7, 2024
@Aemiii91 Aemiii91 self-requested a review March 7, 2024 17:04
andrei nikulin and others added 2 commits March 8, 2024 02:42
Clean code. Removed unnecessary structure.
@Aemiii91 Aemiii91 enabled auto-merge May 9, 2024 20:37
@Aemiii91 Aemiii91 added this pull request to the merge queue May 9, 2024
Merged via the queue into OnionUI:main with commit 1a7c2e1 May 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug in onion Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants