Skip to content

ESP32 BT Classic support#17

Open
DynaMight1124 wants to merge 6 commits into
MegaCadeDev:masterfrom
DynaMight1124:ESP32-BTClassicFix
Open

ESP32 BT Classic support#17
DynaMight1124 wants to merge 6 commits into
MegaCadeDev:masterfrom
DynaMight1124:ESP32-BTClassicFix

Conversation

@DynaMight1124
Copy link
Copy Markdown

Hi

Hopefully you're happy to accept this, it allows the ESP32 to work in BT Classic mode which supports additional controllers, the DS4 most notably and probably loads of others too!

It was completed by AI just to be upfront, but its been working great for me. Also if you're happy, I do have another which allows the Pico to programme the ESP32 via the original devs UART bridge but the function never worked for me so once again AI fixed it.

Below are some details on what files were changed

  1. Firmware/ESP32/sdkconfig
  • DualShock 4 Fix: Enabled Classic Bluetooth (BR/EDR) and configured the dual-mode controller (CONFIG_BTDM_CTRL_MODE_BTDM=y).
  • Connection Fix: Increased the maximum Classic Bluetooth connections from 0 to 5, allowing the DS4 to establish a link.
  1. Firmware/ESP32/main/btstack_config.h
  • Protocol Support: Added #define ENABLE_CLASSIC to compile the Bluetooth stack with the specific protocols required for the DS4 controller.
  1. Firmware/ESP32/CMakeLists.txt
  • C++ Standard: Upgraded CMAKE_CXX_STANDARD from 17 to 20 to support modern C++ features (like requires and Concepts) used in the project's headers.
  • Warning Suppression: Added idf_build_set_property to ignore compiler warnings (-w) and errors (-Wno-error). This is necessary to bypass known issues in the internal ESP-IDF Bluedroid stack when building on v5.1.
  1. Firmware/cmake/init_submodules.cmake
  • Build Reliability: Updated the submodule check to be more robust. It now verifies if submodules are already initialized before attempting to run git, preventing build failures in environments where git might not be in the path during the CMake phase.

Summary of the Sync Fix:
The DS4 failed to sync because the ESP32 was previously locked into BLE-only mode. By enabling Classic Bluetooth in the configuration and stack, the ESP32 is now radio-compatible with the DS4. Upgrading to C++20 and suppressing Bluedroid's internal warnings were the necessary steps to make this configuration compile on your specific IDF version.

   * DualShock 4 Fix: Enabled Classic Bluetooth (BR/EDR) and configured the dual-mode controller (CONFIG_BTDM_CTRL_MODE_BTDM=y).
   * Connection Fix: Increased the maximum Classic Bluetooth connections from 0 to 5, allowing the DS4 to establish a link.
   * C++ Standard: Upgraded CMAKE_CXX_STANDARD from 17 to 20 to support modern C++ features (like requires and Concepts) used in the project's headers.
   * Warning Suppression: Added idf_build_set_property to ignore compiler warnings (-w) and errors (-Wno-error). This is necessary to bypass known issues in the internal ESP-IDF Bluedroid stack when building on v5.1.
Protocol Support: Added #define ENABLE_CLASSIC to compile the Bluetooth stack with the specific protocols required for the DS4 controller.
Build Reliability: Updated the submodule check to be more robust. It now verifies if submodules are already initialized before attempting to run git, preventing build failures in environments where git might not be in the path during the CMake phase.
Some parts of sdkconfig was overwritten by idf which caused controllers not to auto re-sync, so re-added. Will also update sdkconfig.defaults so they are re-added automatically
Added Bluetooth configuration options for connections and authentication.
@mrdude2478
Copy link
Copy Markdown

I've got an esp board that has bluetooth classsic and bluetooth le, would I be able to use old and new controllers with this patch?

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.

2 participants