Skip to content

Protect ISRs, getter and setters with mutex#8

Merged
MaffooClock merged 1 commit intoMaffooClock:mainfrom
kfl02:main
Jan 31, 2025
Merged

Protect ISRs, getter and setters with mutex#8
MaffooClock merged 1 commit intoMaffooClock:mainfrom
kfl02:main

Conversation

@kfl02
Copy link
Copy Markdown

@kfl02 kfl02 commented Oct 26, 2024

When you turn the rotary encoder very quickly, it can happen that the internal value is changed by the ISR between the constrainValue() call and the return statement in getEncoderValue().
I caught that with an assert() in my project.
You should protect the ISR and all getters and setters with a mutex.
I did a quick fix for that.

@MaffooClock
Copy link
Copy Markdown
Owner

My apologies for taking so long to respond! This looks good, and I will test this on my own device before merging and updating the package.

@MaffooClock MaffooClock self-assigned this Jan 23, 2025
@MaffooClock MaffooClock added the enhancement New feature or request label Jan 23, 2025
@MaffooClock MaffooClock added this to the v1.1.1 milestone Jan 23, 2025
@MaffooClock MaffooClock merged commit 4e55e64 into MaffooClock:main Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants