GithubHelp home page GithubHelp logo

esp32-ps3's People

Contributors

jvpernis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-ps3's Issues

Collab in btstack (unijoysticle 2) project

I know this is not an issue but a question, I love your project but I was looking to an approach to cover more controllers.
I saw a project from Ricardo Quesada, the unijoysticle 2, and supports a good amount of controllers, except DS3.
I tried the to connect it, but It appears to be something related to the authentication and pin code request.
I put the ESP32 mac address into the DS3 and starts the sync process but fails after trying to pair with pin code, which is weird since I didn't saw that in your implementation.
Any hint or help would be appreciated, thanks!

ERROR COMPILING

C:\Users\Moisés\Desktop\PROYECTOS MAKER\PS3 + SERVO\Ps3Demo\Ps3Demo.ino: In function 'void setup()':
C:\Users\Moisés\Desktop\PROYECTOS MAKER\PS3 + SERVO\Ps3Demo\Ps3Demo.ino:203:34: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\Mois�s\Documents\Arduino\libraries\PS3_Controller_Host\src\ps3.c: In function 'ps3SetLed':
C:\Users\Mois�s\Documents\Arduino\libraries\PS3_Controller_Host\src\ps3.c:160:5: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
if(cmd.led4 = player >= 4) player -= 4;
^
C:\Users\Mois�s\Documents\Arduino\libraries\PS3_Controller_Host\src\ps3.c:161:5: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
if(cmd.led3 = player >= 3) player -= 3;
^
C:\Users\Mois�s\Documents\Arduino\libraries\PS3_Controller_Host\src\ps3.c:162:5: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
if(cmd.led2 = player >= 2) player -= 2;
^
C:\Users\Mois�s\Documents\Arduino\libraries\PS3_Controller_Host\src\ps3.c:163:5: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
if(cmd.led1 = player >= 1) player -= 1;
^
cc1.exe: some warnings being treated as errors
exit status 1
Error compilando para la tarjeta ESP32 Dev Module.

pairing problems with PS3 controller

I'm using your esp32-ps3 library and not all works fine. after loading the program on my ESP32 boards (I have tried different boards and the effect is the same on ALL my boards) I can pair my PS3 controller and also an PS4 controller. Ich have testet this with the example Ps3Connect.ino and it works but it works only, if I had erased the complete flash of my ESP32 before loading the program. After an simple reset of my ESP32 it's no more possible to pair my controllers.

esptool.py --chip esp32 erase_flash + load program --> pairing works perfekt
reset my ESP32 --> pairing don't work
reload the program to my ESP32 without erase flash before --> pairing don't work

I have change the MAC address in my controllers to the original BT MAC adresses of my ESP32 boards!

And an perhaps important Information is, I have no original SONY controller I'm using clones :-(

Have you any idea what the problem cold be? I think there is and basic initialisation missing ???

best regard from vienna/austria

klaus

Left stick y axis doesn't work

Hi,
While using the arduino library, Ps3.data.analog.stick.ry is always 0 and Ps3.event.analog_changed.stick.ry doesn't seem to work.
All the other axis work fine.
I have connected my ps3 controller to my linux laptop and everything works fine, although jstest seems to assign the axis for r2 to ry and vice-versa.
I am pretty sure the controller that I am using is not genuine.
Any Idea how I could troubleshoot this?
you can have a look through my code here:
https://github.com/BogdanTheGeek/ESP_RC/blob/master/src/Transmitter/Input.cpp

Two ps3 controllers?

Hi, I’m wondering if you know of any way to hook up two ps3 controllers to one esp32 using your library? Thanks!

"The controller still has sufficient battery charge" in loop

Hi,

I'd like to take control of my ESP32 with my PS3 controller :)

I've made a quick app that registers a callback with the given example code and the callback is called for ever...
esp-idf version : v3.3.1
Framework compatibility : Latest stable release

Logs :
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left
The controller still has sufficient battery charge
Currently pulling analog stick to the left

Cheers !

Arduino Ps3Data Example is wrong

The Ps3Data example doesn't compile as the check for the controller being connected line is wrong.
I have modified the code as shown below and it works fine.

#include <Ps3Controller.h>

void setup()
{
    Serial.begin(115200);
    Ps3.begin("01:02:03:04:05:06");
    Serial.println("Ready.");
}

void loop()
{
    if(Ps3.isConnected()){

        if( Ps3.data.button.cross ){
            Serial.println("Pressing the cross button");
        }

        if( Ps3.data.button.square ){
            Serial.println("Pressing the square button");
        }

        if( Ps3.data.button.triangle ){
            Serial.println("Pressing the triangle button");
        }

        if( Ps3.data.button.circle ){
            Serial.println("Pressing the circle button");
        }

    }
}

Chinese PS3 controller

Hello, just a doubt, I would like to see the raw data coming to the bluetooth, I have a clone controller but none of the configurations done is working with this controller thus, I would like to know if there is any way to see the raw data

Difficulty with allocating MAC address of controller

Hi,

When attempting to use the PS3 Controller-paired MAC address in my Arduino sketch ("02-03-04-05-06-07"), the compiler fails with a message
warning: ISO C++ forbids converting a string constant to 'char*' and
Ps3Controller.cpp: In member function 'bool Ps3Controller::begin(char*)':
...path...\Sketch\libraries\esp32-ps3-master\src\Ps3Controller.cpp:53:63: error: format '%x' expects argument of type 'unsigned int*', but argument 3 has type 'uint8_t* {aka unsigned char*}' [-Werror=format=]
if (sscanf(mac, ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX_PTR(addr)) != ESP_BD_ADDR_LEN){

I have very little competence in C++ but from the hours I've spent trying to understand this, it looks like the MAC address in Setup is a string (double quotes), failing to be captured as a char (would be single quotes) and then failing to be processed to a constant uint8_t (unsigned integer type). This is only a little better than a guess at the issue but it would be helpful to get it working.

Thanks,

Tim

Reconnecting to esp32 does not work.

Hello. Thanks a lot for your work!
In version 1.1.0 of the library, the ability to reconnect the controller has disappeared. The previous version had such an opportunity.
The situation is this: if you connect the controller and do not use it for about 8 minutes, it will "fall asleep", it will not connect to esp32 again.

Expecting the possibility of connecting multiple controllers to one esp 2.

How can I contact you for cooperation?

PS3 Controller code too big for ESP32

I'm currently using a PS3 controller to control a robot on an ESP32. Which works fine.

I now need to add WIFI support as well to the ESP32. When I compile this the PS3 and WIFI are too big for the ESP32 flash. Having reviewed this library I suspect much of this code is in the Bluetooth library, not the PS3. Are there any parts of these libraries I could thin down (remove) in order to have a simple joystick (maybe buttons) control with Wifi?

Incorrect operation when communication is lost.

Hello.
Found a feature of the firmware behavior.
For example:
1- download Ps3Demo
2- connect controller
3- take the controller far away or place it in a box or room where there is no communication.
The ESP32 will not understand the moment of losing the controller and will be staggeringly sending commands, as well as "receiving" commands from the left stick "Moved the right stick: x = -1 y = -128".
If the controller is brought closer to esp within range, it will connect and continue normal operation.

If the controller is out of communication long enough, then it may shut down, but esp will continue to send and receive commands.

Please inform me if I am not clear, I will try to explain it differently. The message was translated with the help of a translator.

13:40:24.751 -> Connected.
13:40:24.791 -> The controller battery is HIGH
13:40:26.780 -> Setting LEDs to player 1
13:40:28.780 -> Setting LEDs to player 2
13:40:30.777 -> Setting LEDs to player 3
13:40:32.780 -> Setting LEDs to player 4
13:40:34.780 -> Setting LEDs to player 5
13:40:36.780 -> Setting LEDs to player 6
13:40:38.780 -> Setting LEDs to player 7
// from this time the controller no longer receives commands
13:40:39.740 -> Moved the right stick: x=-1 y=-128 //This means that the controller is lost, but the ESP continues to work normally.
13:40:39.740 -> The controller battery is UNDEFINED // Processing once on controller loss
13:40:40.780 -> Setting LEDs to player 8
13:40:42.780 -> Setting LEDs to player 9
13:40:44.780 -> Setting LEDs to player 10
13:40:46.750 -> Setting LEDs to player 0
13:40:48.750 -> Setting LEDs to player 1
13:40:50.750 -> Setting LEDs to player 2
13:40:52.750 -> Setting LEDs to player 3
13:40:54.750 -> Setting LEDs to player 4
13:40:56.750 -> Setting LEDs to player 5
13:40:58.750 -> Setting LEDs to player 6
13:41:00.753 -> Setting LEDs to player 7
13:41:02.759 -> Setting LEDs to player 8
13:41:04.771 -> Setting LEDs to player 9
13:41:06.771 -> Setting LEDs to player 10
13:41:08.771 -> Setting LEDs to player 0
13:41:10.771 -> Setting LEDs to player 1
13:41:12.771 -> Setting LEDs to player 2
13:41:14.771 -> Setting LEDs to player 3
13:41:16.780 -> Setting LEDs to player 4
13:41:18.781 -> Setting LEDs to player 5
13:41:20.781 -> Setting LEDs to player 6
13:41:22.781 -> Setting LEDs to player 7
13:41:24.781 -> Setting LEDs to player 8
13:41:26.781 -> Setting LEDs to player 9
13:41:28.781 -> Setting LEDs to player 10
13:41:30.781 -> Setting LEDs to player 0
13:41:32.751 -> Setting LEDs to player 1
13:41:34.751 -> Setting LEDs to player 2
13:41:36.751 -> Setting LEDs to player 3
// Around this time, the controller fell asleep.
13:41:38.759 -> Setting LEDs to player 4
13:41:40.762 -> Setting LEDs to player 5
13:41:42.762 -> Setting LEDs to player 6
13:41:42.762 -> E (171412) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed
13:41:44.762 -> Setting LEDs to player 7
13:41:44.762 -> E (173412) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed
13:41:46.762 -> Setting LEDs to player 8
13:41:46.762 -> E (175412) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed
13:41:48.762 -> Setting LEDs to player 9
13:41:48.762 -> E (177412) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed

I noticed an interesting point, with the Ps3Demo firmware the controller has a communication radius larger than my firmware with this library. I use libraries #include "esp_system.h, #include <Ps3Controller.h>. No complicated calculations are done.

Cant combine two codes

There are code with live video streaming + listening commands from port 400 and sending to serial.
Need add code to paire ps3 gamepad over Bluetooth. I can paire ps3 with esp32cam with example code from library.
But there is many errors when adding ps3conltroller library to code for vodeo streaming.
Help please.

ESP32Cam. Board "AI Thinker ESP32-CAM"

WiFi ESP32-CAM Controller on Android app..https://play.google.com/store/apps/details?id=com.fvasquez.esp32_wifi_controller&hl=en_US&gl=US

`/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/

IMPORTANT!!!

  • Select Board "AI Thinker ESP32-CAM"
  • GPIO 0 must be connected to GND to upload a sketch
  • After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*********/`

`#include <Ps3Controller.h>

int Flashlight = 4;
bool Flashlightstatus=false;

void notify()
{
//--- Digital cross/square/triangle/circle button events ---
if( Ps3.event.button_down.cross )
Serial.println("cross_on");
if( Ps3.event.button_up.cross )
Serial.println("cross_off");

if( Ps3.event.button_down.square )
    Serial.println("square_on");
if( Ps3.event.button_up.square )
    Serial.println("square_off");

if( Ps3.event.button_down.triangle )
    Serial.println("triangle_on");
if( Ps3.event.button_up.triangle )
    Serial.println("triangle_off");

if( Ps3.event.button_down.circle )
    Serial.println("circle_on");
if( Ps3.event.button_up.circle )
    Serial.println("circle_off");

//--------------- Digital D-pad button events --------------
if( Ps3.event.button_down.up ){
    Serial.println("up_on");

}
if( Ps3.event.button_up.up ){
Serial.println("up_off");
}

if( Ps3.event.button_down.right ){
    Serial.println("right_on");

}
if( Ps3.event.button_up.right ){
Serial.println("right_off");
}

if( Ps3.event.button_down.down ){
    Serial.println("down_on");

}
if( Ps3.event.button_up.down ){
Serial.println("down_off");
}

if( Ps3.event.button_down.left ){
    Serial.println("left_on");

}
if( Ps3.event.button_up.left ){
Serial.println("left_off");
}

//------------- Digital shoulder button events -------------
if( Ps3.event.button_down.l1 )
    Serial.println("left1_on");
if( Ps3.event.button_up.l1 )
    Serial.println("left1_off");

if( Ps3.event.button_down.r1 )
    Serial.println("right1_on");
if( Ps3.event.button_up.r1 )
    Serial.println("right1_off");

//-------------- Digital trigger button events -------------
if( Ps3.event.button_down.l2 )
    Serial.println("left2_on");
if( Ps3.event.button_up.l2 )
    Serial.println("left2_off");

if( Ps3.event.button_down.r2 )
    Serial.println("right2_on");
if( Ps3.event.button_up.r2 )
    Serial.println("right2_off");

//--------------- Digital stick button events --------------
if( Ps3.event.button_down.l3 )
    Serial.println("left3_on");
if( Ps3.event.button_up.l3 )
    Serial.println("left3_off");

if( Ps3.event.button_down.r3 )
    Serial.println("right3_on");
if( Ps3.event.button_up.r3 )
    Serial.println("right3_off");

//---------- Digital select/start/ps button events ---------
if( Ps3.event.button_down.select )
    Serial.println("select_on");
if( Ps3.event.button_up.select )
    Serial.println("select_off");

if( Ps3.event.button_down.start )
    Serial.println("start_on");
if( Ps3.event.button_up.start )
    Serial.println("start_off");

if( Ps3.event.button_down.ps ){
    Flashlights();
    Serial.println("ps_on");}
if( Ps3.event.button_up.ps ){
    Serial.println("ps_off");}


//---------------- Analog stick value events ---------------

if( abs(Ps3.event.analog_changed.stick.lx) + abs(Ps3.event.analog_changed.stick.ly) > 2 ){
Serial.print("lsx"); Serial.println(Ps3.data.analog.stick.lx, DEC);
Serial.print("lsy"); Serial.println(Ps3.data.analog.stick.ly, DEC);
}

if( abs(Ps3.event.analog_changed.stick.rx) + abs(Ps3.event.analog_changed.stick.ry) > 2 ){
Serial.print("rsx"); Serial.println(Ps3.data.analog.stick.rx, DEC);
Serial.print("rsy"); Serial.println(Ps3.data.analog.stick.ry, DEC);
}

}

void onConnect(){
Serial.println("Connected.");
// Turn rumble on full intensity
Ps3.setRumble(100.0, 1000);
delay(500);
// Turn rumble on full intensity indefinitely
Ps3.setRumble(50.1000);
delay(500);
// Turn off rumble
Ps3.setRumble(0.0);

    Flashlights();
    delay(1000);
    Flashlights();

}

void setup()
{
Serial.begin(115200);

Ps3.attach(notify);
Ps3.attachOnConnect(onConnect);
Ps3.begin("8c:ce:4e:88:47:ea");

Serial.println("Ready.");

pinMode(Flashlight, OUTPUT);
}

void loop(){
if(!Ps3.isConnected()){
return;
}

delay(100);

}

void Flashlights(void)
{
if (!Flashlightstatus){
digitalWrite(Flashlight,HIGH);
Flashlightstatus=true;}
else{
digitalWrite(Flashlight,LOW);
Flashlightstatus=false;}
}`

Bluetooth MAC address workaround

Hi,

Your excellent work here follows the same method of enabling the PS3 controller to be connected to the ESP32 Bluetooth (Use sixaxispair tool and write the reported address in setup) seen on most other sources. I reported an issue on your Github project regarding this method which caused problems for me but used a workaround to get past the issue.

The workaround was to run the sketch Getting the MAC Address of the ESP32 and then use the sixaxispair tool to write the address to the PS3 controller. Doing this meant I didn't need to specify any MAC address in setup, resulting in a compilation that didn't fail and I was able to carry on with my project. It also means that the controller will always be paired to that ESP32.

I think all of the PS3 controller "How-to" videos/web pages suggest using the sixaxispair tool and some even say you can change the address stored there but I didn't come across anyone suggesting that entering the MAC address of your ESP32 Bluetooth Interface would be a good idea. Is this worth an update to your Pairing the PS3 Controller: section?

Tim

https://techtutorialsx.com/2018/03/09/esp32-arduino-getting-the-bluetooth-device-address/

Error compiling library

Initially I was getting a else without if error when I attempted to compile. Error was in ps3_gap.c file on line 107. I noticed there weren't any {} with the if so I added. That seemed to make that error go away.

Now when I compile I am getting the following errors with all the examples included with the library.
Any suggestions???

Thanks
Dave

Arduino: 1.8.14 Hourly Build 2020/12/15 11:34 (Mac OS X), Board: "ESP32 Dev Module, DIO, 80MHz, 4MB (32Mb), 921600, None"
libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_init_service+0x1c): undefined reference to GAP_ConnOpen' libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_event_handle+0xc): undefined reference to GAP_ConnGetL2CAPCid'
libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_event_handle+0x10): undefined reference to GAP_ConnBTRead' libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_send_hid+0x14): undefined reference to GAP_ConnBTWrite'
libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_init_service': /Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnOpen'
libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_update_connected': /Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnGetL2CAPCid'
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnGetL2CAPCid' libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_event_handle':
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnBTRead' libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_send_hid':
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:103: undefined reference to GAP_ConnBTWrite' libraries/esp32-ps3-master/ps3_spp.c.o:(.literal.ps3_spp_callback+0x8): undefined reference to esp_bt_gap_set_scan_mode'
libraries/esp32-ps3-master/ps3_spp.c.o:(.literal.ps3_spp_callback+0xc): undefined reference to esp_spp_start_srv' libraries/esp32-ps3-master/ps3_spp.c.o:(.literal.ps3_spp_init+0x14): undefined reference to esp_spp_register_callback'
libraries/esp32-ps3-master/ps3_spp.c.o:(.literal.ps3_spp_init+0x18): undefined reference to esp_err_to_name' libraries/esp32-ps3-master/ps3_spp.c.o:(.literal.ps3_spp_init+0x1c): undefined reference to esp_spp_init'
libraries/esp32-ps3-master/ps3_spp.c.o: In function ps3_spp_callback': /Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:103: undefined reference to esp_bt_gap_set_scan_mode'
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:106: undefined reference to esp_spp_start_srv' libraries/esp32-ps3-master/ps3_spp.c.o: In function ps3_spp_init':
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:68: undefined reference to esp_spp_register_callback' /Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:69: undefined reference to esp_err_to_name'
/Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:73: undefined reference to esp_spp_init' /Users/djmrozinski/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_spp.c:74: undefined reference to esp_err_to_name'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Controller Disconnect handling

Hi,
Thank you for this fantastic library :)
I have allready commented into another open issue, but got no Response.
So, here I tell my Problem again ;)

I am using a ps3 Navigation Controller with the ESP32 "wroom" from AZdelivery.

Everything is working fine and I am very happy implementing all those Events easiely.

But, I have no chance to catch any disconnect event.
I wanted to implement some failsave code to my rc System, unfortunately that isn't possible for me at the Moment.

I would be very happy for any help at this Point.

Best regards

Arduino 1.8.12 Compilation Error

C:\Users\user\Documents\Arduino\libraries\esp32-ps3-master\src\Ps3Controller.cpp: In member function 'bool Ps3Controller::begin(char*)':

C:\Users\user\Documents\Arduino\libraries\esp32-ps3-master\src\Ps3Controller.cpp:53:63: error: format '%x' expects argument of type 'unsigned int*', but argument 3 has type 'uint8_t* {aka unsigned char*}' [-Werror=format=]

     if (sscanf(mac, ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX_PTR(addr)) != ESP_BD_ADDR_LEN){

                                                               ^

C:\Users\user\Documents\Arduino\libraries\esp32-ps3-master\src\Ps3Controller.cpp:53:63: error: format '%x' expects argument of type 'unsigned int*', but argument 4 has type 'uint8_t* {aka unsigned char*}' [-Werror=format=]

When I'm running Ps3.begin() I'm getting the error: Registering GAP service [...] failed

Not sure if this is direct result of the library, but when I'm running Ps3.begin() I'm getting the error:

E (263747) PS3_GAP: ps3_gap_init_service Registering GAP service PS3-HIDC failed
E (263747) PS3_GAP: ps3_gap_init_service Registering GAP service PS3-HIDI failed

The function works as expected when running in a small program but when running in a more complex program it's throwing these errors.
Are any special timers/registers or something required that might already be in use?

Originally posted by @klimbot in #3 (comment)

Changing the CPU speed is not affecting the performance.

I added a loop timer in the Ps3Data example code which prints the time taken by the loop to execute. I tested it on 80MHz, 160MHz and 240MHz CPU frequency on the ESP32. Usually, a higher CPU frequency leads to faster execution of the loop, but the loop time in all three cases is the same. I tried a normal for loop without the ps3 library and I got the performance boost on increasing the CPU speed. I assume that this is an issue with the ps3 library. Can someone explain why I am facing this issue?

PS3_Controller_Host - help

Hello, thank you very much for the bookstore.

i'm trying to get my jostick ps3 to work, but i can't.

It compiles well but it just doesn't connect, the lights don't stop flashing, the strange thing is that if I reset the esp32, the control in a few seconds turns off. that is, it kind of connects partially, but it never tells me that it has successfully connected.

I have tried it to jostick with my pc, with cable and saw bluetooth to play games and it works correctly

I'm using
ide arduino 1.8.10
ide arduino 1.8.13
ide esp32 1.0.1
ide esp32 1.0.4
PS3_Controller_Host, I have tried all versions.

https://subefotos.com/ver/?1c41f19008ca20912858e625fe2ac360o.png

License question

Hello, and thanks for the great work!
I would like to be using the library for a home-built robot project, which I intend to open source myself.
But the lack of license currently stops me.
Legally, if a license is not published, then the work is under exclusive copyright, no matter it's on github :)
Thus it can't be copied, distributed, modified, etc. Not sure if it can even be used.
https://choosealicense.com/no-permission/

No problem if this is intended. It comes to my mind that it may be limited from the PS3 protocol itself, which is not really public, AFAIK.
I'd just appreciate some more clarity about it, so I can make my choices.

Best regards, and once again - great job!

Minimal example not connecting

Hi, sorry to be spamming you with issues and thanks for you help with the install.

I used the sixaxis pair tool to set the ps3 BT master to the value that is printed during flashing.

Connecting.....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: b4:e6:2d:ee:7b:fd
Uploading stub...

The code in the main file is modified from the hello_world example:

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "ps3.h"
#include "nvs_flash.h"  //included to stop some nvs errors

void controller_event_cb(ps3_t ps3, ps3_event_t event)
{
    if (ps3.button.triangle)
        printf("Currently pressing the trangle button");
}

void app_main()
{
    printf("Before setup\n");
    ps3SetEventCallback(controller_event_cb);

    //ADDED THIS TO STOP ERROR MESSAGES COMPLAING ABOUT NVS FLASH INIT
    nvs_flash_init();

    ps3Init();
    while (!ps3IsConnected())
        ;

    printf("After setup\n");
}

There were errors to do with nvs_flash, but I fixed that by calling nvs_flash_init(). However, the code still seems not to connect. This is the output of make monitor which never reaches printf("After setup\n"):

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6352
ho 0 tail 12 room 4
load:0x40078000,len:11308
load:0x40080400,len:6680
entry 0x40080760
I (30) boot: ESP-IDF v4.0-dev-207-g76da10a66 2nd stage bootloader
I (30) boot: compile time 18:45:07
I (39) boot: Enabling RNG early entropy source...
I (39) boot: SPI Speed      : 40MHz
I (40) boot: SPI Mode       : DIO
I (44) boot: SPI Flash Size : 4MB
I (48) boot: Partition Table:
I (52) boot: ## Label            Usage          Type ST Offset   Length
I (59) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (66) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 factory          factory app      00 00 00010000 00100000
I (81) boot: End of partition table
I (86) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x23354 (144212) map
I (145) esp_image: segment 1: paddr=0x0003337c vaddr=0x3ffbdb60 size=0x02a80 ( 10880) load
I (150) esp_image: segment 2: paddr=0x00035e04 vaddr=0x40080000 size=0x00400 (  1024) load
0x40080000: _WindowOverflow4 at D:/msys32/home/ags/esp/esp-idf/components/freertos/xtensa_vectors.S:1779

I (152) esp_image: segment 3: paddr=0x0003620c vaddr=0x40080400 size=0x09e04 ( 40452) load
I (178) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0x74a88 (477832) map
0x400d0018: _flash_cache_start at ??:?

I (345) esp_image: segment 5: paddr=0x000b4aa8 vaddr=0x4008a204 size=0x080b4 ( 32948) load
0x4008a204: r_lld_pdu_rx_handler at ??:?

I (370) boot: Loaded app from partition at offset 0x10000
I (370) boot: Disabling RNG early entropy source...
I (370) cpu_start: Pro cpu up.
I (374) cpu_start: Application information:
I (379) cpu_start: Project name:     hello-world
I (384) cpu_start: App version:      1
I (388) cpu_start: Compile time:     Jul  9 2019 18:44:07
I (394) cpu_start: ELF file SHA256:  b7c0231e2b184b06...
I (400) cpu_start: ESP-IDF:          v4.0-dev-207-g76da10a66
I (407) cpu_start: Starting app cpu, entry point is 0x400810a0
0x400810a0: call_start_cpu1 at D:/msys32/home/ags/esp/esp-idf/components/esp32/cpu_start.c:267

I (0) cpu_start: App cpu up.
I (417) heap_init: Initializing. RAM available for dynamic allocation:
I (424) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (430) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (436) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (442) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (448) heap_init: At 3FFCCF78 len 00013088 (76 KiB): DRAM
I (455) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (461) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (467) heap_init: At 400922B8 len 0000DD48 (55 KiB): IRAM
I (474) cpu_start: Pro cpu start user code
I (156) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Before setup
I (218) BTDM_INIT: BT controller compile version [80351af]
I (218) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (308) phy: phy_version: 4100, 6fa5e27, Jan 25 2019, 17:02:06, 0, 0
I (918) PS3_SPP: ESP_SPP_INIT_EVT
I (938) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDC Initialized
I (938) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDI Initialized
E (5918) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (5918) task_wdt:  - IDLE0 (CPU 0)
E (5918) task_wdt: Tasks currently running:
E (5918) task_wdt: CPU 0: main
E (5918) task_wdt: CPU 1: IDLE1

I also tried to set the mac address but that gets the same results:

static const char macStr[] = "b4:e6:2d:ee:7b:fd";
    unsigned int iMac[6];
    uint8_t mac[6];
    sscanf(macStr, "%x:%x:%x:%x:%x:%x", &iMac[0], &iMac[1], &iMac[2], &iMac[3], &iMac[4], &iMac[5]);
    int i;
    for (i = 0; i < 6; i++)
        mac[i] = (unsigned char)iMac[i];
    esp_base_mac_addr_set(mac);

Thanks

Unable to pair

I'm using Arduino IDE with DOIT ESP32 DEVKIT V1. I've used this module successfully on a number of other projects. This is my first try using bluetooth. I have two controllers purchased on Amazon that are not official PS3 and are labelled OUBANG on the outside. I have determined the MAC address of the controller(s) by plugging them into my MacBook Pro and looking at the Bluetooth settings. The mac address appears as the MacBook attempts to connect. The MacBook also reports this description from the controller - via PLAYSTATION(R)3 Conteroller - PANHAI
In any event I get 'Ready' on the serial monitor and the red lights on the controller continue to flash until they time out. I have paired these controllers previously with a RasPi. Could they have the RasPi's MAC address in them?

Any ideas?
Thanks
Jim

feature request: expose the PS3 controller state as a BLE HID joystick

This would allow to use a ESP32 as a bridge between the PS3 controller and a Windows/Linux/Mac/Android device. Given the sad state of the PS3 controller support, people would love you about this as everyone could use now their devices everywhere and without any hassle. Hopefully this would be low hanging fruit for you and this would be a fun weekend project.

BTW this idea ocurred to me after I (shamelessly) filed the PS3 BT linux question.

edit: OK I will give it a go, let's hope the BT and BLE libs wont clash!

Hello, Thanks for your work, I want to remote my ballancing robot with a PS3 controller.

Hello, Thanks for your work, I want to remote my ballancing robot with a PS3 controller.
I'm testing "Ps3Connect exemple" In arduino IDE, My controller is well connected but there is no comunication with the datas. axis always at zero, and no button press notification
The monitor tell me : "the controller baterry charge is undefined" and the controller is always bliking.

Here are the logs
logs.txt

Did I have to use ESP-IDf to modify the bluetooth protocol BLE=>BR/EDR ?
The mac adress of BT ESP32 is the same that is paired in Sisxaxispairtool.

Thank you very much

The controller is working fine with my PS3.

Have you any idea ?

Originally posted by @YannP84 in #3 (comment)

micropython!

Hi
I appreciate for such wonderful job you have done, but is there any similar library for micro-python?
or give me some hint to where should i look for it.

thanks again.

ESP32 arduino software version

Hi,

Did some tests and successfully used your library a couple of months ago.
As I am now going to use it in my project I was checking current status and noticed this remark.

The reason I'm asking you is because I'm quite aware that the library is not going to be compatible with their upcoming release 1.0.5. When you download the boards from the GitHub directly, you are getting their latest software, which currently is 1.0.5-rc6. This version is not available in the Arduino IDE.

Does that mean that this library cannot be used at all with newer versions (1.05 and upcoming IDF4) or is it temporary and will those be supported by upcoming updates ?

Arduino IDE Library manager downloads out of date files

Hi,

I'm using the Arduino IDE (1.8.13) with a WEMOS D1 MINI ESP32, attempting to get a cheap andcheerful PS3 controller working over bluetooth. When I use the Arduino library manager to download the library I get an old version of ps3.c (9,598 bytes) whereas using the version extracted from the zipped file (9,634 bytes) has the ps3SetLed function parentheses issue fixed. The download by library manager version goes into a folder called PS3_Controller_Host whereas the zip file is unzipped to esp32-ps3-master

I'm presuming that it should not matter which method of adding a library is used, (library download or Sketch-Include Library-Add .Zip library), they should both have the same contents. Not sure this is an issue with your repository or Github, but there may be other Arduino IDE users out there failing to make use of your excellent work because version control seems to have gone awry.

Thanks for the good work

BT initialization to cohexists with BLE

I created a repo that allows you to, without using any drivers, use your PS3 Controller on Windows, Mac, Android and iOS systems (or any HID hosts!), it will just work!

For that I made 2 changes in your lib:

  1. make BT cohexist with BLE
  2. support GASIA devices

Here is the project along with your modified lib: https://github.com/aguaviva/PS3ToBle

Rather than sending a MR I would like you to check out my code and incorporate the changes I made however you see fit.

Can't connect ESP32 to PS3 Controller

It might seem to be something pretty obvious to
Add the library to the Arduino IDLE..
Go to the examples..
Pick one..
Change the MAC address..
Select the board ESP32 Dev Module..
Upload the code..
Wait... ...and nothing happens.
Please let me know if any of you has the same issue and how to solve it.
I am using third parties controllers, and originals but none of them work.

ESP32 to Ps3 controllers will not connect, followed all known steps, can you help?

Hi
Firstly, I'm very grateful for you putting this code up online, and excited to try and use it on my projects. But I have been trying to get this to work for about a week now with no luck. I have four ESP32 development boards, all are NodeMCU ESP32S Devkit V1.
I have two official Sony PS3 Controllers, one is a Sixaxis the other a Sixaxis Dual Shock 3 (both are over 10 years old, but can still pair with the games console itself). I don't know if country is relevant to the model of controller, but I'm in the UK.
Finally, I am using the Arduino IDE 1.8.15, with the Espressif ESP32 Board Manager installed, and your Ps3Controller library.

I have obtained the bluetooth MAC addresses for all the ESP32s using 'Ps3Address'. I have used the Sixaxis pairing tool to discover the stored MAC in the controllers, and then change it to the ESP32 BT MAC (and checked that it stays in the memory).

I have then tried to use the Ps3Connect sketch, the only change I have made is to add in my board's BT MAC. Here is the code:


#include <Ps3Controller.h>

void setup()
{
Serial.begin(115200);
Ps3.begin("7c:9e:bd:48:bf:02");
Serial.println("Ready.");
}

void loop()
{
if (Ps3.isConnected()){
Serial.println("Connected!");
}

delay(3000);
}

__

It compiles and uploads fine, I open the serial monitor, reset the ESP32 using the EN button, and it reads:


ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1100
ho 0 tail 12 room 4
load:0x40078000,len:12308
load:0x40080400,len:3076
entry 0x400805ec
Ready.


I then push the connect button (central one!) on the Ps3 (have tried quick push and holding down), the 4 red LEDS on the back flash quickly for around a minute, but nothing else happens. Nothing more in the serial monitor. Have also tried resetting the ESP32 whilst controller LEDS are flashing. Have tried every combination of my four NodeMCUs with both controllers. Have reset the original PS3 console MAC into the controllers, and they pair again. I have even tried uninstalling then reinstalling the ESP32 board manager and the PS3Controller library, and tried regressing to previous library versions.

Have tried looking for alternative code on the internet but nothing else works.

Can you help in any way? Is this something to do with the espressif IDF? Does my development board not work with PS3 BT for some reason? I cannot think what else to try.

Many thanks for any assistance you can offer.

Kind regards

Alex

E (29) system_api: Base MAC must be a unicast MAC

The examples use a non-unicast MAC. I see that this bug has already been fixed in the PS4-esp32 library, so you may want to change the examples to use a similar MAC (1a:2b:3c:01:01:01).

(The lsb of the first byte must be 0.)

I am not sure where I would find the analog stick functions as I am quite new to Arduino IDE

Hello, I have gotten your library working on my esp, and the four buttons work perfectly (cross, triangle, circle and square). I am just wondering about the functions for the analog sticks on the ps3 remote and the other buttons as well. I am not sure where I would find these functions as I am quite new to Arduino IDE. Any help would be greatly appreciated.

Originally posted by @bennellis in #3 (comment)

Esp32-s3 and Ps3 controller

Thanks a lot for your library. What do you think about using esp32 -s3, which is more powerfull and has more gpio?

Question on how to pair the ps3 controller on linux (sorry for the off topic!!)

Bluez keeps asking for a PIN, no matter what agent I use, I'd appreciate so much your help!!! :)

$ bluetoothctl 
Agent registered
[CHG] Controller 5C:AC:4C:CA:C5:FF Pairable: yes
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# devices
Device 00:26:5C:BC:07:01 Sony PLAYSTATION(R)3 Controller
[CHG] Device 00:26:5C:BC:07:01 Connected: yes
[Sony PLAYSTATION(R)3 Controller]# pair 00:26:5C:BC:07:01
Attempting to pair with 00:26:5C:BC:07:01
[agent] PIN code: 405922

I am so sorry for the off-topic!!

Led lights and Rubble not working

Hi There

First of thanks for this fantastic library works really well on the getting feedback from the the button just what i needed

Unfortunately i am not have much luck with feeding back to the controller

I am running on a esp32, coding in arduino and using what assume is a knock off ps3 controller

i am running the following command

// To set led 1 to light up
Ps3.setPlayer(1);
Verify's fine but doesn't seem to make any changes on the ps3 controller, also give no errors message

// to ruble controller
Ps3.setRumble(100.0, 1000);
Verify's fine
Report following error message "E (544498) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed"

Any help would greatly appreciated

James

Connection fails with l2cap error

I'm implementing a really bare-bones test using ESP-IDF (v4.4.1). After some struggles I got it to build and run on an ESP32, waiting for a connection. But as soon as I try to connect a controller it throws an error:
E (26693) BT_BTM: btm_sec_l2cap_access_req: (acceptor) remote features unknown!!sec_flags:0x80

I've dug through but lost track somewhere in the source of esp-idf. I would've liked to make it a discussions post rather than an issue, maybe it would be worth enabling that for the repo :)

undefined reference

Hi,
I just download the library and try to compile with Arduino IDE 1.8.13 and esp32 but found many undefined reference

libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_init_service+0x1c): undefined reference to GAP_ConnOpen' libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_event_handle+0xc): undefined reference to GAP_ConnGetL2CAPCid'
libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_event_handle+0x10): undefined reference to GAP_ConnBTRead' libraries/esp32-ps3-master/ps3_gap.c.o:(.literal.ps3_gap_send_hid+0x14): undefined reference to GAP_ConnBTWrite'
libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_init_service': /Users/leo/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnOpen'
libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_update_connected': /Users/leo/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnGetL2CAPCid'
/Users/leo/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnGetL2CAPCid' libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_event_handle':
/Users/leo/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:60: undefined reference to GAP_ConnBTRead' libraries/esp32-ps3-master/ps3_gap.c.o: In function ps3_gap_send_hid':
/Users/leo/Documents/Arduino/libraries/esp32-ps3-master/src/ps3_gap.c:103: undefined reference to `GAP_ConnBTWrite'
collect2: error: ld returned 1 exit status
exit status 1
Errore durante la compilazione per la scheda Node32s.

Arduino Library?

Hi, is it scheduled to release also a modify Library based on this Espressif one which works with Arduino IDE. Up to now I think there is nothing around like this in the net. Unfortunaley I'am not such a Bleutooth specialist to do this by myself :-(

gyroscope data - help

hello, how can I get the gyroscope values ​​of the " axes x", and "the axis y" ??

//      to display the gryoscope data: */

   Serial.print(Ps3.data.sensor.gyroscope.z);
//------------------------///
ps3_sensor_t ps3_parse_packet_sensor( uint8_t *packet )
{
    ps3_sensor_t ps3_sensor;

    const uint16_t int_offset = 0x200;

    ps3_sensor.accelerometer.x = (packet[ps3_packet_index_sensor_accelerometer_x] << 8) + packet[ps3_packet_index_sensor_accelerometer_x+1] - int_offset;
    ps3_sensor.accelerometer.y = (packet[ps3_packet_index_sensor_accelerometer_y] << 8) + packet[ps3_packet_index_sensor_accelerometer_y+1] - int_offset;
    ps3_sensor.accelerometer.z = (packet[ps3_packet_index_sensor_accelerometer_z] << 8) + packet[ps3_packet_index_sensor_accelerometer_z+1] - int_offset;
    ps3_sensor.gyroscope.z     = (packet[ps3_packet_index_sensor_gyroscope_z]     << 8) + packet[ps3_packet_index_sensor_gyroscope_z+1]     - int_offset;

    return ps3_sensor;

}

Add work with vibration motors

Hello.
Thank you so much for creating this library for the Arduino IDE.
Will vibration motor control be added?
Or maybe it is not described in the instructions?

Error while trying to connect

Hello!

I am running this component on ESP-IDF v4.2 with following code:

void app_main(void)
{
    uint8_t new_mac[8] = {0x30,0xae,0xa4,0xbf,0x5b,0x7e};
    esp_base_mac_addr_set(new_mac);
    nvs_flash_init();

    ps3SetEventCallback(controller_event_cb);
    ps3SetBluetoothMacAddress(new_mac);
    ps3Init();
    while (!ps3IsConnected()) {
        // Prevent the Task Watchdog from triggering
        vTaskDelay(10 / portTICK_PERIOD_MS);
    }
}

I set the custom MAC-address on two original PS3 controllers with the SixaxisPairerTool. While trying to connect to the ESP with either controller, the following error appears in the logs everytime the PS-button is pressed:

I (1178) PS3_SPP: ESP_SPP_INIT_EVT
I (1198) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDC Initialized
I (1198) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDI Initialized
E (4538) BT_BTM: btm_sec_l2cap_access_req: (acceptor) remote features unknown!!sec_flags:0x80

PS3 controller connecting but reporting the error code: 0x02

I can't seem to get data from the controller (that I just discovered it is a chinese clone).

This is a summary of the BT transactions:

  1. The PS3 controller connects to the esp32 when I press the PS button
  2. The esp32 sends the "sony_set_operational_bt" ("0x53, 0xf4, 0x42, 0x03, 0x00, 0x00")
  3. The PS3 controller replies with a 1 byte l2cap data packet, just containing a "2", this might indicate an error as per this code http://www.pabr.org/sixlinux/patch-hidd-3.19-pabr3, see the code below "Wait for ack from device to ensure compliance with HIDP 7.9.1" expecting a 0.

Here are the details of the transaction, any help is more than welcome :)

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
esp32 BT address: 80:7D:3A:B9:BA:B2 <- This is the mac of my esp32, and it is stored in the controller

I (582) PS3_SPP: ps3_spp_init begin
I (583) PS3_SPP: ps3_spp_init end

I (583) PS3_L2CAP: [ps3_l2cap_init_services] begin

    I (1250) PS3_L2CAP: [ps3_l2cap_init_service] begin
        I (1248) PS3_SPP: ps3_spp_callback begin event 0
        I (1254) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDC Initialized
        I (1259) PS3_SPP: ESP_SPP_INIT_EVT
    I (1265) PS3_L2CAP: [ps3_l2cap_init_service] end

    I (1268) PS3_SPP: esp_bt_gap_set_scan_mode

    I (1273) PS3_L2CAP: [ps3_l2cap_init_service] begin
        I (1281) PS3_L2CAP: [ps3_l2cap_init_service] Service PS3-HIDI Initialized
            I (1282) PS3_SPP: ps3_spp_callback begin event 28
    I (1287) PS3_L2CAP: [ps3_l2cap_init_service] end

I (1296) PS3_L2CAP: [ps3_l2cap_init_services] end

OK
Ready.
[I][Ps3ToBle.ino:250] setup(): TAG

************* Here I press the PS button *************

I (11482) PS3_L2CAP: [ps3_l2cap_connect_ind_cback] bd_addr: 
  l2cap_cid: 0x40
  psm: 17
  id: 1

I (11496) PS3_L2CAP: [ps3_l2cap_config_ind_cback] l2cap_cid: 0x40
  p_cfg->result: 0
  p_cfg->mtu_present: 0
  p_cfg->mtu: 0

I (11498) PS3_L2CAP: [ps3_l2cap_config_cfm_cback] l2cap_cid: 0x40
  p_cfg->result: 0

I (11524) PS3_L2CAP: [ps3_l2cap_connect_ind_cback] bd_addr: 
  l2cap_cid: 0x41
  psm: 19
  id: 3

I (11551) PS3_L2CAP: [ps3_l2cap_config_ind_cback] l2cap_cid: 0x41
  p_cfg->result: 0
  p_cfg->mtu_present: 0
  p_cfg->mtu: 0

I (11553) PS3_L2CAP: [ps3_l2cap_config_cfm_cback] l2cap_cid: 0x41
  p_cfg->result: 0

I (11559) PS3_L2CAP: ps3Enable begin
I (11562) PS3_L2CAP: [ps3_l2cap_send_hid] begin
I (11567) PS3_L2CAP: [ps3_l2cap_send_hid] len 6, event 13, offset 49188, 53, f4, 42, 03, 00, 00
I (11576) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: success
I (11581) PS3_L2CAP: [ps3_l2cap_send_hid] end
I (11585) PS3_L2CAP: ps3Enable end

I (11604) PS3_L2CAP: [ps3_l2cap_data_ind_cback] begin
I (11604) PS3_L2CAP: [ps3_l2cap_data_ind_cback] packet len 1, data: 0x02  <- it should return a 0x00 (see link above)
I (11604) PS3_L2CAP: [ps3_l2cap_data_ind_cback] end

Any help with this on how to debug it is more than welcome :)

Oh! And thanks for this great project!!

Ps3 controller could not connect with esp32 MAC address. ASSERT_WARN

Thanks for implement the lib for doing ps3 controller connection.

However I am encountering an issue of not able to connect. I 've followed instruction reset ps3 console mac stored in controller

tried both on SixaxisPairTool or sixaxispairer , then boot esp with below code . leave begin without MAC so it use esp32 default MAC which is 3c:61:05:32:1e:22

#include <Ps3Controller.h>

void setup()
{
    Serial.begin(115200);
    Ps3.begin();
    Serial.println("Ready.");
}

void loop()
{
  if (Ps3.isConnected()){
    Serial.println("Connected!");
  }

  String address = Ps3.getAddress();
    Serial.println(address);

  delay(2000);
}

From the COM log , I could only see ASSERT_WARN(1 9), in lc_task.c at line 13943c:61:05:32:1e:22 but no connection.

Can you advise some way for me to troubleshot it further ?

Thanks

can't find ESP_BT_CONNECTABLE variable

I've installed the esp idf framework and ran the hello world example.

I copied the code snipped on the readme into the hello world main.c and put your ps3 library and the esp-idf/components/bt into the components folder in the hello world example. For good measure I also copied your ps3 folder into the components directory in the esp-idf/components folder. Is that what you mean by install globally?

However when I run make flash I get this error. It looks like I have not included esp_gap_bt_api.h properly, but I'm new to this and must have done it incorrectly. Do you have any tips? Thanks

make output:

Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
Compiler version: 5.2.0
Python requirements from D:/msys32/home/ags/esp/esp-idf/requirements.txt are satisfied.
CC build/ps3/ps3_spp.o
D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c: In function 'ps3_spp_callback':
D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c:95:34: error: 'ESP_BT_CONNECTABLE' undeclared (first use in this function)
         esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
                                  ^
D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c:95:34: note: each undeclared identifier is reported only once for each function it appears in
D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c:95:54: error: 'ESP_BT_NON_DISCOVERABLE' undeclared (first use in this function)
         esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
                                                      ^
D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c:95:9: error: too many arguments to function 'esp_bt_gap_set_scan_mode'
         esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
         ^
In file included from D:/msys32/home/ags/esp/hello_world/components/ps3/ps3_spp.c:13:0:
D:/msys32/home/ags/esp/esp-idf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h:361:11: note: declared here
 esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
           ^
make[1]: *** [/home/ags/esp/esp-idf/make/component_wrapper.mk:286: ps3_spp.o] Error 1
make: *** [D:/msys32/home/ags/esp/esp-idf/make/project.mk:530: component-ps3-build] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.