Connecting PS4 controller to ESP32
Posted: Wed Jan 11, 2023 1:25 am
Hi,
I have been trying to connect PS4 controller to an ESP32 with a minimal example, any help would be greatly appreciated.
ESP-IDF v4.4.2
ESP-32S NodeMCU v1.1
I am using this library https://github.com/aed3/PS4-esp32
Current behaviour: PS4 controller turns off immediately
I've changed the MAC address on the PS4 to match, it looks like the controller tries to connect to the ESP32 and shuts off immediately.
I have been trying to connect PS4 controller to an ESP32 with a minimal example, any help would be greatly appreciated.
ESP-IDF v4.4.2
ESP-32S NodeMCU v1.1
I am using this library https://github.com/aed3/PS4-esp32
Current behaviour: PS4 controller turns off immediately
I've changed the MAC address on the PS4 to match, it looks like the controller tries to connect to the ESP32 and shuts off immediately.
Code: Select all
void gamepad_event_cb(ps4_t ps4, ps4_event_t ev)
{
ESP_LOGI("PS4", "ENTERING CB");
}
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
uint8_t mac[8] = {0x00, 0x02, 0x03, 0x04, 0x05, 0x06};
ps4SetBluetoothMacAddress(mac);
ps4SetEventCallback(gamepad_event_cb);
ps4Init();
while (!ps4IsConnected())
{
// Prevent the Task Watchdog from triggering
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}
Code: Select all
I (468) cpu_start: Application information:
I (472) cpu_start: Project name: ps4
I (477) cpu_start: App version: 1
I (481) cpu_start: Compile time: Jan 11 2023 09:10:27
I (487) cpu_start: ELF file SHA256: b9952d5e78e73931...
I (493) cpu_start: ESP-IDF: v4.4.2
I (498) heap_init: Initializing. RAM available for dynamic allocation:
I (505) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (511) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (518) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (524) heap_init: At 3FFC9BA8 len 00016458 (89 KiB): DRAM
I (530) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (536) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (543) heap_init: At 40097084 len 00008F7C (35 KiB): IRAM
I (550) spi_flash: detected chip: winbond
I (554) spi_flash: flash io: dio
I (559) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (606) BTDM_INIT: BT controller compile version [bf9c077]
I (606) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1306) PS4_SPP: ESP_SPP_INIT_EVT
I (1326) PS4_L2CAP: [ps4_l2cap_init_service] Service PS4-HIDC Initialized
I (1326) PS4_L2CAP: [ps4_l2cap_init_service] Service PS4-HIDI Initialized
W (8466) BT_HCI: hcif conn complete: hdl 0x80, st 0x0
W (8486) BT_HCI: hcif link supv_to changed: hdl 0x80, supv_to 8000
W (9586) BT_HCI: hcif disc complete: hdl 0x80, rsn 0x5