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

JoyCons power-off feature #334

Merged
merged 2 commits into from
May 9, 2020
Merged

JoyCons power-off feature #334

merged 2 commits into from
May 9, 2020

Conversation

andreabak
Copy link
Contributor

Hi.

I've implemented a couple of simple power-off feature(s) for JoyCons.

  1. AutoPowerOff: automatically power off joycons at program exit
  2. HomeLongPowerOff: power off joycons when Home (right only joycon or combined joycons) or Capture (left only joycon) button is pressed for a long interval (hard-coded to 2s)

In order to detect long-presses of the Home/Capture buttons I've added some basic timestamp tracking for when buttons are pressed.

feature-joycons-poweroff

Tested only on JoyCons, not Pro nor SNES controller.

@Davidobot
Copy link
Owner

Davidobot commented May 9, 2020

Oh! This is rather exciting! I'll test and merge it ASAP.

Does this allow joycons to reconnect to Windows without any problems after powering down? (ie just by pressing a button on the joycon to wake it and reconnect)

EDIT: I should put SetHCIState to good use and replace the other references to the command with that :)

@andreabak
Copy link
Contributor Author

My joycons reconnect automatically to Windows on button press, unless they are previously re-paired/connected/charging with my Switch. This could be a welcome quirk of the Bluetooth adapter though.

It would be nice to automatically (or with the pair button) pair/re-pair them without having to go through Windows settings, because if they are paired back to the Switch they need to be first removed from Bluetooth devices then re-paired to Windows and it can be annoying, especially when the battery runs out and I want to switch them with my other joycons that are charging. But I think this is beyond the scope of this PR.

@Davidobot
Copy link
Owner

My joycons reconnect automatically to Windows on button press, unless they are previously re-paired/connected/charging with my Switch. This could be a welcome quirk of the Bluetooth adapter though.

Great, that's all I wanted to know.

Unfortunately, that sort of unable to reconnect without Windows settings behaviour is unavoidable. I mean, even the switch can't pair automatically with the controllers after they've been paired a PC. Though there are some saved-device MAC address packets in the documentation - I'll poke around.

@Davidobot Davidobot merged commit 3b10bb6 into Davidobot:master May 9, 2020
@andreabak andreabak deleted the feature/joycons-poweroff branch May 9, 2020 17:42
d3xMachina pushed a commit to d3xMachina/BetterJoy that referenced this pull request Nov 19, 2021
* Tracking button down timestamps (for long press detection)
* Added joycons power-off functionality
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

2 participants