Skip to content

Conversation

@liquidraver
Copy link
Contributor

Core Stuff

  • Unified common code into SerialBLECommon.h base class
    (it should reside in a helpers/bluetooth folder with all the nrf/esp files, but this PR is not for tidying up)

  • ESP32: Migrated from ESP32 BLE library to NimBLE - Re-pair could be needed! Full erase would be preferable for updating to clear out old BT library stuff from the flash. Factory reset does not clear that.

    • this also resolves xiao c3 bootloops because of too much sensors (-~500k from flash)

Connection

  • Reject second connection attempts (single connection only) (edge case!)
  • Improved disconnect handling with reason codes and initiator tracking (for debugging who is to blame for disconnects)

Dynamic connection parameters

  • Added sync mode: switches to low-latency params (0 latency, 12-24ms interval) for high throughput
  • Sync mode when the fw auto-detects large frame activity (40+ bytes, 3+ frames in 1.5s window)
  • Falls back to default mode (3 latency, 12-36ms interval) after 5s inactivity
  • Tracks connection parameter updates via BLE events

Queue & Transfer Improvements

  • Circular queue implementation replaces linear array shifts - less RAM/CPU
  • Added send interval throttling (8ms minimum) - undetectable by user, but helps stabilize the ble stack, on ESP this is mandatory!
  • Improved retry logic with throttle window (250ms) - throttle sending when we detect spotty BT connection

ESP32 Specific:
Well... everything that nRF had already are now in ESP's interface :) even "turbo mode"

The two platform's BLE interface is now more or less the same (with library dependent differences of course)

@fdlamotte
Copy link
Collaborator

fdlamotte commented Dec 28, 2025

well did a first test with thinknode M5 ... it connects but I have no response to APPSTART :(

I have an heltec_v3, I'll try with it ...

update: I erased the device, removed it from the PC and did the pairing again ... now I can connect

Is it necessary to to a full erase before using it with the new lib ?

@liquidraver
Copy link
Contributor Author

well did a first test with thinknode M5 ... it connects but I have no response to APPSTART :(

I have an heltec_v3, I'll try with it ...

update: I erased the device, removed it from the PC and did the pairing again ... now I can connect

Is it necessary to to a full erase before using it with the new lib ?

On my test devices it was not necessary, but the MAC is the same and bluetooth keys on ESP are on the NVS partition, they can conflict. A factory reset won't erase that.

On paper IDF and nimBLE does not use the same namespace on NVS, but it can cause hard-to-debug bugs.
(we should add NVS erase to our factory reset function, so it will mean the same as on nRF, i.e.: completely clean slate)

Completely ditching ESP-IDF and using a brand new lib so starting fresh on flash is recommended.

Copy link
Collaborator

@ripplebiz ripplebiz left a comment

Choose a reason for hiding this comment

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

Nice work!

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.

3 participants