Repository navigation
Conversation
Co-authored-by: gagarinlg <54738901+gagarinlg@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for switching Bluetooth subsystems via commands
Add AT commands to switch between BLE, Classic BT/A2DP, and Bluetooth off
Oct 15, 2026
Collaborator
|
Thanks for the PR. Some notes after reviewing it against the current development branch ( Base and conflicts
Hardware scope
Functionality
Process
Happy to help port it onto |
Member
|
It was just a test run of Copilot, nothing too serious. In the end it would be great to be able to use bletooth audio, when the HW supports it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The firmware was BLE-only. This PR adds runtime commands to turn BLE and Bluetooth Classic/A2DP on and off, so audio streaming can replace the FrSky/BLE behaviour without a reflash. BLE and A2DP are mutually exclusive, so the module switches between them rather than running both at once.
I couldn't compile or run this: there was no ESP-IDF or PlatformIO toolchain available. Please build and test it on a board.
Commands (existing AT-style parser)
Mode switching (
terminal.c)role_thandled by the existingsetRole().setRole()tears down the current stack first: A2DP deinit, then Bluedroid and controller disable.AT+BLEONreturns to the last BLE role (central by default).Mode:<name>when BLE is off.Persistence
ROLE_BTEDR_AUDIO_SOURCEandROLE_BT_OFFare appended torole_t, so saved values keep their meaning. The mode is stored in the existing NVS settings blob.BT stack (
bt.c, newbt_a2dp.c/bt_a2dp.h)bt_init()is now a thin wrapper over a shared start path, andbt_classic_init()is new.CONFIG_BT_CLASSIC_ENABLEDandCONFIG_BT_A2DP_ENABLE, andbt_a2dp_supported()reports whether it's available.Review notes
CONFIG_BT_CLASSIC_ENABLEDunset, so until a classic-ESP32 sdkconfig enables both options,AT+A2DPONreturnsERRORand BLE behaves as before.esp_bt_gap_set_scan_mode()andesp_a2d_source_register_data_cb()use the IDF 4.4/5.x signatures. Please check them against the IDF version PlatformIO resolves.