aed3 / PS4-esp32

Use a ps4 controller with an esp32
328 stars 103 forks source link

problem: esp32 can't reconnect ps4, has Solution #46

Closed yangjianxiao closed 2 years ago

yangjianxiao commented 2 years ago

I'm chinese, poor english, sorry!

i found, in esp32's flash,has paired ps4's bluetooth mac adress, this mac is not right, so, at begin, remove paired mac , it works. code like this: note: first,use sixpairtool, modify ps4 's bluetooth'mac with esp32's blurtooth mac

include "esp_bt_main.h"

include "esp_bt_device.h"

include"esp_gap_bt_api.h"

include "esp_err.h"

include

void remove_pair(){ uint8_t pairedDeviceBtAddr[10][6];

btStart(); esp_bluedroid_init(); esp_bluedroid_enable(); int count = esp_bt_gap_get_bond_device_num(); Serial.print(" bonded device found:"); Serial.println(count); if (count>0) { esp_err_t tError = esp_bt_gap_get_bond_device_list(&count, pairedDeviceBtAddr);
for(int i = 0; i < count; i++) esp_bt_gap_remove_bond_device(pairedDeviceBtAddr[i]); } }

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

any question: yangjianxiao@gmail.com