Skip to content

Allow arbitrary number of headtrack channels - #3373

Merged
pkendall64 merged 7 commits into
ExpressLRS:masterfrom
CapnBry:variable-headtrack
Nov 20, 2025
Merged

pkendall64 merged 7 commits into
ExpressLRS:masterfrom
CapnBry:variable-headtrack

Conversation

@CapnBry

@CapnBry CapnBry commented Oct 24, 2025 •

Copy link
Copy Markdown
Member

Alters our MSP_ELRS_BACKPACK_SET_PTR (headtracking channel data message) to support any number of channels, 0 to 16. The purpose of this is to allow a wireless pedal that only writes a single channel, or sending as many trainer channels as we want to EdgeTX.

Values which should not be updated should be set by the MSP sender to 0xffff or just don't include them-- the 0xffff value is only needed for sparsely overriding some channels. Note any time a MSP_ELRS_BACKPACK_SET_PTR MSP packet is received, it must include all overriden channels, we will not merge multiple headtracker inputs, although that is possible if we store a per-channel timeout instead of a global one.

Test Object

The Pedal backpack branch is on my github and not ready for PR yet, but works with ESP development boards for testing. The simplest pedal is an ESP32 devkit, where the boot button is the pedal input (Pedal_ESP32_Backpack_via_UART environment). There's also a working ESP32S3, but the ESP32C3 drops a lot of ESPNOW updates so don't use that one.

Blocker (sort of)

EDIT: Resolved in #3362
In testing I found our headtracking implementation is a little busted right now and for some packets will not properly override the value due to a concurrency issue between the handset reading process and the OTA copy process. Details here: #3363 (comment)

This happens on master so it has nothing to do with these changes.

@CapnBry CapnBry added enhancement 🪄 New feature or request V4.0 🍔 labels Oct 24, 2025
@ExpressLRS ExpressLRS deleted a comment from sonarqubecloud Bot Oct 27, 2025
@CapnBry

CapnBry commented Oct 27, 2025

Copy link
Copy Markdown
Member Author

Added do not merge tag because this will need a rework following #3363 to resolve the blocker.

I also don't know what a "B" maintainability rating on new code means so thanks for that, AI

@CapnBry

CapnBry commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

Updated to use the concurrency mechanism from #3363. I added b1633a5 as well as I forgot this copy happened in that PR. It doesn't make much difference here though, as the RcChannelsOverrideCallback wasn't set at AutodetectHandset time anyway.

New blocker added with hack work around!
The CRSFRouter broadcasts the channels packet OTA because it has no extended header and therefore the router doesn't unicast it. As a result, the channels packets to EDGETX are being queued and uploaded to the RX in 1:2 telemetry mode and those channels are sent to the flight controller. /slaps forehead

As a hack I've forced it to not send it OTA but this will need some other fix because mine is a giant hack.

@pkendall64 pkendall64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can remove the HACK part as part of the TX USB PR #3378

@CapnBry

CapnBry commented Nov 3, 2025

Copy link
Copy Markdown
Member Author

Yeah so let's hold off for that PR, then I'll rebase and this one can go without the HACK bit.

@CapnBry

CapnBry commented Nov 12, 2025

Copy link
Copy Markdown
Member Author

Updated to use the new crsfRouter.deliverMessageTo() and remove all hacks. Thanks PK!

Tested with pedal backpack and betaflight, still working. Ready for review.

@pkendall64
pkendall64 merged commit 39832d5 into ExpressLRS:master Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🪄 New feature or request V4.0 🍔

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants