ricardoquesada / bluepad32

Bluetooth gamepad, mouse and keyboard support for ESP32 and PicoW
https://bluepad32.readthedocs.io/
Other
566 stars 59 forks source link

How to disconnect controller? #36

Closed tapererwaj closed 1 year ago

tapererwaj commented 1 year ago

Is there a built-in method in this library that I can use to disconnect a connected controller after pressing any button on the controller , if not, can you suggest a way to achieve this.

ricardoquesada commented 1 year ago

fixed, I'm assuming you are using the Arduino API.

will be part of the next stable release

https://gitlab.com/ricardoquesada/bluepad32/-/commit/227db920471c5fe78f40820e090124748df2cbcc https://gitlab.com/ricardoquesada/bluepad32/-/commit/a702cc6c4b210c3df32f5ff86fcc5ce8b98c0a37

tapererwaj commented 1 year ago

Hello, thank you for your reply.

When will the next stable release be available?

On Sat, 20 May 2023, 20:42 Ricardo Quesada, @.***> wrote:

fixed, I'm assuming you are using the Arduino API.

will be part of the next stable release

https://gitlab.com/ricardoquesada/bluepad32/-/commit/227db920471c5fe78f40820e090124748df2cbcc

https://gitlab.com/ricardoquesada/bluepad32/-/commit/a702cc6c4b210c3df32f5ff86fcc5ce8b98c0a37

— Reply to this email directly, view it on GitHub https://github.com/ricardoquesada/bluepad32/issues/36#issuecomment-1555903818, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWQBYA62FMMFZGCWHBT2O6TXHC35BANCNFSM6AAAAAAYIPHYC4 . You are receiving this because you authored the thread.Message ID: @.***>

ricardoquesada commented 1 year ago

I don't have a date, but soon :)

perhaps in one week or less

tapererwaj commented 1 year ago

Okay, much appreciated

On Sat, 20 May 2023, 23:06 Ricardo Quesada, @.***> wrote:

I don't have a date, but soon :)

perhaps in one week or less

— Reply to this email directly, view it on GitHub https://github.com/ricardoquesada/bluepad32/issues/36#issuecomment-1555931824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWQBYAZ4OPPBA4QQZ6YCPILXHDMXPANCNFSM6AAAAAAYIPHYC4 . You are receiving this because you authored the thread.Message ID: @.***>

ricardoquesada commented 1 year ago

v3.7.2 released

tapererwaj commented 1 year ago

fixed, I'm assuming you are using the Arduino API.

will be part of the next stable release

https://gitlab.com/ricardoquesada/bluepad32/-/commit/227db920471c5fe78f40820e090124748df2cbcc https://gitlab.com/ricardoquesada/bluepad32/-/commit/a702cc6c4b210c3df32f5ff86fcc5ce8b98c0a37

Can I also use this for the ESP32 DEVKIT?

ricardoquesada commented 1 year ago

yep. if it works with regular ESP32 Arduino, then it should work with ESP32-Bluepad32 Ardunio.

tapererwaj commented 1 year ago

I have tried using the disconnect class method through the Controller example as shown in the image below:

image

But the ESP32 just reboots and gives me the following error:

image

How can I resolve this issue?

ricardoquesada commented 1 year ago

mmm.... let me double check it.

ricardoquesada commented 1 year ago

I cannot reproduce it... seems to be working ok with me.

Please provide:

tapererwaj commented 1 year ago

Platform: Arduino IDE v2.1.0 ESP32 Chip - ESP32-D0WDQ6 (revision v1.0) esptool.py v4.5.1 OS - Windows 11 Controller - PS5 Dual Sense

Arduino IDE Sketch: Controller.zip

tapererwaj commented 1 year ago

Platform: Arduino IDE v2.1.0 ESP32 Chip - ESP32-D0WDQ6 (revision v1.0) esptool.py v4.5.1 OS - Windows 11 Controller - PS5 Dual Sense

Arduino IDE Sketch: Controller.zip

ricardoquesada commented 1 year ago

In you code you have:

      if (myGamepad->x()) {
        // try to disconnect the controller
        myGamepad->disconnect();
        return;  // <--- DO NOT RETURN FROM update();
      }

just remove the return;

tapererwaj commented 1 year ago

It works, thank you

tapererwaj commented 1 year ago

Sorry to disturb, but can you assist me with my school project code below: ESP32_Elephant_Master.zip

I am trying to use the ESP32 as a Bluetooth module for an Arduino mega. I will be using I2C for the communication between ESP32 and Arduino.

I tried implementing the Controller example but it causing the ESP to reboot every time I try to disconnect the controller.

ricardoquesada commented 1 year ago

look at the NINA code, which is similar as what you want but using SPI: https://gitlab.com/ricardoquesada/bluepad32/-/blob/main/docs/plat_nina.md