Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable serial trainer for foreign protocols (SBUS improvements / CRSF / Ibus / SumD) #4102

Draft
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

gagarinlg
Copy link
Member

@gagarinlg gagarinlg commented Sep 24, 2023

Fixes #1460
Resolves #1607

This is a copy of #1462, living in the EdgeTX repo, to not accidentally break stuff for @wimalopaan when we finalise this PR

@gagarinlg
Copy link
Member Author

For whatever reason, this just works, with some minor tweks.

The open issue is, that the trainer data is processed in the 1ms timer interrupt handler, which needs to be changed.

@gagarinlg gagarinlg added this to the 2.10 milestone Sep 24, 2023
@pfeerick
Copy link
Member

Probably a good idea to skim through the unresolved review points from #1462 also to see if they still apply or not ;) From my point of view, the only other outstanding issues were the lack of any documentation on how to actually use it or any limitations (i.e. hardware requirements), or what testing had been done - since it was adding support for four more serial trainer protocols.

wimalopaan and others added 16 commits September 27, 2023 19:27
* moved the interfaces to header files
* introduced option EXTENDED_TRAINER (32 trainer channels, switches for sumd)
* introduced cli interface to get statistics for trainer input
* added code to disable BT-Module (put !EN-pin to high) when AUX2 is powered on
* added some debug output (statistics of incoming packets)
* added sumd V3 decoding of mode-command/sub-command
* added lua functions to query the sumd V3 commands
* fixed wrong return value conversion
switch(mState) { // enum-switch -> no default (intentional)
case State::Undefined:
csum.reset();
if (b == Crsf::FcAddress) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that although ExpressLRS receivers currently output this as their first byte, it is incorrect CRSF and will be changed at some point. Correct CRSF starts with 0xC8 always (UART_SYNC in the Crossfire units). Betaflight, iNav, ExpressLRS, EdgeTX and many other systems don't check the first byte or check it against a variety of values to validate the frame.

Also note there's a perfectly good CRSF frame parser already in pulses/Crossfire.cpp so it would be nice to not duplicate the code, and with different behavior between them.

I think ideally ExpressLRS would love to be able to send CHANNELSPACKED/SUBSETPACKED on its telemetry connection as well for use as a trainer or to forward headtracking data directly from the TX module's backpack into EdgeTX.

Copy link
Member Author

Choose a reason for hiding this comment

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

That last part sounds interesting

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.

CRSF input for Trainer mode Trainer-Input also via IBus and SumD
7 participants