Skip to content

Guard 2M PHY mode for NimBLE#8890

Merged
thebentern merged 7 commits into
developfrom
revert-2m-phy
Dec 9, 2025
Merged

Guard 2M PHY mode for NimBLE#8890
thebentern merged 7 commits into
developfrom
revert-2m-phy

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

Original change introduced by #8261
We have seen a number of reports of issues with particularly desktop PC / Mac bluetooth regressions due to the PHY increase. This change macro-guards that mode.
If someone wishes to use the 2M PHY mode for NimBLE, they can add -DNIMBLE_ENABLE_2M_PHY=1 to their PIO ini environment build flags.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new NIMBLE_ENABLE_2M_PHY macro guard to disable the 2M PHY mode feature by default in NimBLE, addressing Bluetooth regression issues reported with desktop PC and Mac connections. Users can opt-in to the 2M PHY mode by adding -DNIMBLE_ENABLE_2M_PHY=1 to their build flags.

Key Changes:

  • Added NIMBLE_ENABLE_2M_PHY guard to conditional compilation blocks controlling 2M PHY preference and MTU settings
  • Modified guards in both onConnect() callback and setup() function to require explicit opt-in for 2M PHY mode

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/nimble/NimbleBluetooth.cpp Outdated
Comment thread src/nimble/NimbleBluetooth.cpp Outdated
Comment thread src/nimble/NimbleBluetooth.cpp Outdated
Comment thread src/nimble/NimbleBluetooth.cpp
thebentern and others added 4 commits December 7, 2025 07:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thebentern thebentern added the bugfix Pull request that fixes bugs label Dec 7, 2025
@phaseloop

phaseloop commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Just FYI - this is 99% caused by buggy ESP-IDF version as we are using Arduino 2.x and ESP-IDF V4.X

I advocate for some plan to move to pioarduino based on ESP-IDF V5.5 which has a ton of bugs fixed, both for BT and power management.

Example: #8876

There is also suspicion (by me) that some NRF52 boards with external LF crystal (for example T114) have faulty crystals throwing off bluetooth connections on some faster timings. This was reported already by several Nordic customers. So there is mess to manage on both platforms :/

@thebentern

Copy link
Copy Markdown
Contributor Author

Just FYI - this is 99% caused by buggy ESP-IDF version as we are using Arduino 2.x and ESP-IDF V4.X

I advocate for some plan to move to pioarduino based on ESP-IDF V5.5 which has a ton of bugs fixed, both for BT and power management.

Example: #8876

There is also suspicion (by me) that some NRF52 boards with external LF crystal (for example T114) have faulty crystals throwing off bluetooth connections on some faster timings. This was reported already by several Nordic customers. So there is mess to manage on both platforms :/

Would you mind propoosing that PR separately @phaseloop. I'm sure @caveman99 has thoughts as well :-)

@phaseloop

Copy link
Copy Markdown
Contributor

Would you mind propoosing that PR separately @phaseloop. I'm sure @caveman99 has thoughts as well :-)

I created a GH issue to discuss it along with migration plan. AFAIK this aligns well with idea to move ADC and power management functions to each /platform codebase and not litter main files with hundreds of #ifdefs

#8896

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@thebentern thebentern merged commit c052963 into develop Dec 9, 2025
84 checks passed
scobert969 pushed a commit to zeropt/meshtastic-firmware that referenced this pull request Dec 22, 2025
* Guard 2M PHY mode for NimBLE

* Update src/nimble/NimbleBluetooth.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Another #endif snuck in there

* Move endif

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@caveman99 caveman99 deleted the revert-2m-phy branch February 12, 2026 15:31
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
* Guard 2M PHY mode for NimBLE

* Update src/nimble/NimbleBluetooth.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Another #endif snuck in there

* Move endif

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants