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

Fix Disconnect Bug #11

Merged
merged 4 commits into from Jul 27, 2018
Merged

Fix Disconnect Bug #11

merged 4 commits into from Jul 27, 2018

Conversation

dmadison
Copy link
Owner

There's a small bug in the auto-connect logic where if a controller disconnects in the controller detect pin stage (isConnected()) rather than the update stage, the LED is not cleared and the HID keypresses are not released.

I rewrote the class to use onConnect and disconnect methods. This should handle both potential disconnect cases.

Need to separate behavior for initial connect vs successive update.
Now handles the onConnect and onDisconnect functions only if the state changes.
Rather than updating the 'connected' variable from update, just read the update result directly. If 'connected' needs to be modified, it can be done in the disconnect function.
Makes things easier to read and think about: "If connected, disconnect". Keeping the "onConnect" function the same since it doesn't actually connect to the controller.
@dmadison dmadison merged commit 28b53ed into master Jul 27, 2018
@dmadison dmadison deleted the disconnect-bug branch July 27, 2018 17:56
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

Successfully merging this pull request may close these issues.

None yet

1 participant