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

Incorrect analog readings for keys pressed before initialization. #21

Open
Zripzri opened this issue Nov 1, 2021 · 1 comment
Open

Comments

@Zripzri
Copy link

Zripzri commented Nov 1, 2021

When an analog read is performed (either for a specific key or for all keys) for a key that was already pressed before initialization, it sometimes returns 0.0 instead of the correct value (and does not appear in the list returned when reading all keys).
Doing consecutive reads, the second one may still give the incorrect value.
Adding a (100ms) delay between initialization and reading seemed to fix the issue (maybe a race condition?).

Some environmental details in case they are of interest:
SDK Version: 0.6.0
Language: C++ (compiled with g++ -std=c++14 -o2)
System: Ubuntu 20.04
Keyboard: Wooting Two HE

@simon-wh
Copy link
Member

simon-wh commented Dec 1, 2021

Hmmmm, to me it sounds like this is due to the SDK's general initialisation being a sync function and the initial finding of devices is sync, but the analog data only starts being read in a new thread so its async. So there's no guarantee that the SDK will be ready to report the device's analog immediately after initialisation.

I'm surprised that such a long delay is needed to get it to report the values, I'd imagine that the max time needed would only need to be a few ms to account for the time in-between the reading thread starting and it receiving the next analog report coming in from the keyboard

If your application is needing the values of keys over the lifetime of the app I'd just ensure that you init the SDK early on so it's already got some analog data coming in by the time you need it

Sorry for the late response, I lost track of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants