Add BLE CRSF telemetry mode for ESP32C3 TX backpack#222
Open
nileshmdev wants to merge 1 commit into
Open
Conversation
CRSF telemetry only — MAVLink is not forwarded over BLE. - HM-10 GATT service (0xFFE0/0xFFE1) + Device Information Service - New BACKPACK_TELEM_MODE_BLUETOOTH; CRSF telemetry routed to one transport only - SetSoftMACAddress() early for BLE device name; re-applied before esp_now_init()
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.
Scope
CRSF telemetry only. MAVLink is not forwarded over BLE in this PR.
For MAVLink, continue using the existing WIFI UDP transport.
Companion PR
Radio-side UI change that lets the user actually select the new
"Bluetooth" telemetry mode: ExpressLRS/ExpressLRS#3671
Neither PR breaks anything when merged alone:
radios never send it.
silently ignore unknown mode values.
Suggested merge order: this Backpack PR first, then the ExpressLRS
PR. That way no user sees a menu option that does nothing because their
backpack firmware doesn't support it yet.
Summary
Adds an opt-in BLE transport for the ESP32C3 TX backpack so CRSF
telemetry can be viewed on phones / browsers that speak the HM-10 GATT
profile, alongside the existing ESP-NOW and WiFi UDP transports.
Changes
BACKPACK_TELEM_MODE_BLUETOOTHmode wired into the existing TLM-modeconfig flow.
0xFFE0/0xFFE1withREAD | NOTIFY.0x180A) so the backpackidentifies itself cleanly to scanners.
BLE_TELEM_ENABLED; only enabled forESP32C3_TX_Backpack_via_UART. Other targets unchanged.h2zero/NimBLE-Arduino @ ^2.5.0dependency for that target only.Drive-by fixes (justified by the BLE work)
SetSoftMACAddress()is now called beforedevicesInit()sofirmwareOptions.uidis populated in time for the BLE device name.Because
devicesInit()then runswifiOff(), the call is repeatedbefore
esp_now_init()to keep ESP-NOW working.MSP_ELRS_BACKPACK_CRSF_TLMnow routes telemetry to exactly onetransport. Previously WIFI and ESPNOW were sent in parallel (the
ESP-NOW path silently failed in WIFI mode because ESP-NOW isn't
initialised there). This also avoids 2.4 GHz radio contention in BLE
mode.
Test plan
All three telemetry modes (WIFI, ESPNOW, BLE) tested end-to-end.
Hardware used
Test app
Used my own viewer: https://nileshmdev.github.io/flighttrace/#/
The web app supports all three transports:
Results
ELRS Backpack XXXXXX, DIS values readable,0xFFE1notifications carryBE EFheartbeat + live CRSF telemetry.received and decoded by the web app over USB serial.
perspective; redundant ESP-NOW path (which was failing silently) is no
longer attempted.
Screenshots
(BLE telemetry viewed in app — screenshot to be attached when
opening the PR.)
Notes for reviewers
byte-identical without the
BLE_TELEM_ENABLEDflag.one-way (notify only) for now.