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 (Ibus/SumD) #1462

Closed
wants to merge 31 commits into from

Conversation

wimalopaan
Copy link
Contributor

WIP for #1460

still limitations:

  • only ibus
  • missing all translations but german

@wimalopaan
Copy link
Contributor Author

wimalopaan commented Jan 19, 2022

SumD not yet implemented because updated SJ receiver can output SBus.

@wimalopaan wimalopaan marked this pull request as draft January 19, 2022 11:24
@wimalopaan wimalopaan marked this pull request as ready for review January 19, 2022 11:25
@raphaelcoeffic
Copy link
Member

@wimalopaan considering what has been done in #1089, we should probably revamp this code on top of main once #1089 is merged, and add a parameters to choose the protocol, don't you think? or even better, make some sort of auto-detection if possible.

@wimalopaan
Copy link
Contributor Author

@wimalopaan considering what has been done in #1089, we should probably revamp this code on top of main once #1089 is merged, and add a parameters to choose the protocol, don't you think? or even better, make some sort of auto-detection if possible.

Yes!
First and simple, I would like to add a parameter to select the protocol SBUS or IBUS or (maybe) SumD/V3.

Is it now possible to receive the serial inverted, so that a user simply can feed in the (inverted) Sbus-Signal of some arbitrary RX with Sbus-Out?

@wimalopaan
Copy link
Contributor Author

Actually trying to rebase this

@raphaelcoeffic
Copy link
Member

raphaelcoeffic commented Mar 21, 2022

You will have some fun, it has changed a bit ;-)

you might be luckier with just cherry-picking your commit on top of current main.

@pfeerick
Copy link
Member

So have you noticed yet that if you power on the radio (TX16S) with either SBUS, IBUS or CRSF trainer options selected the radio locks up at the splash screen? 😁 SUMD seems to be immune to this new feature ;)

@wimalopaan
Copy link
Contributor Author

wimalopaan commented Mar 28, 2022

So have you noticed yet that if you power on the radio (TX16S) with either SBUS, IBUS or CRSF trainer options selected the radio locks up at the splash screen? grin SUMD seems to be immune to this new feature ;)

Yes, I can reproduce that.
Since the IBus and SBus existed before serial rewrite, this may related to serial rewrite ...
SumD clearly is immune because it is in all cases a noop up to now.

Can you try the same with LUA-mode enabled? Does that lock up the radio too?

Thanks for testing.

@raphaelcoeffic
Copy link
Member

Requires #1742

@wimalopaan
Copy link
Contributor Author

Requires #1742

Can you explain that?

Will it take some time to merge #1742? If so, is there a workaround I can try?

@pfeerick
Copy link
Member

Can you try the same with LUA-mode enabled? Does that lock up the radio too?

Do you mean as in the LUA option in the serial port menu? If so, no, that didn't lock up. It was only the SBUS, IBUS and CRSF trainer options that locked up. telemetry mirror was fine, telemetry in was fine, and I've used GPS and CLI before without issue.

For what it's worth... SBUS trainer in main (i.e. 2.7.0rc1) doesn't lockup when the SBUS trainer option is ... but I'm sure Raphael will enlighten us more as to what's happening... I'm going to bet on trying to access a timer that's not ready yet...

@wimalopaan
Copy link
Contributor Author

I think

int sbusAuxGetByte(uint8_t* byte)
{
auto _getByte = _sbusAuxGetByte;
auto _ctx = _sbusAuxGetByteCtx;
if (_getByte) {
return _getByte(_ctx, byte);
}
return -1;
}

should return 0 or false in case being not fully initialised. -1 implicitly converts to true.

But I think the return type should be bool anyway, since this is the outcome of the FIFO, and later on that is casted from bool to int. And this function returns then -1 instead of 0 or better false in case not initialised.

I think that this is a flaw of serial rewrite and should be fixed there first ...

@wimalopaan
Copy link
Contributor Author

The last change fixes the freeze problem at least on my radio.
This is mainly a change to serial rewrite, so maybe this should be cherry-picked to main?

@wimalopaan
Copy link
Contributor Author

... I forgot to change the code for the taranis radios ...

* 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
@pfeerick pfeerick added this to the 2.9 milestone Oct 1, 2022
@pfeerick pfeerick added enhancement ✨ New feature or request rebase needed A git rebase on top of the latest destination branch version is required. needs: testing labels Oct 1, 2022
@HThuren
Copy link
Contributor

HThuren commented Nov 4, 2022

DA translation
add radio/translations/da.h :-)

#define TR_AUX_SERIAL_MODES "FRA\0 ""S-Port spejl\0 ""Telemetri\0 ""SBUS træner\0 ""IBUS træner\0 ""CRSF træner\0 ""SUMD træner\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 "

@Eldenroot
Copy link
Contributor

CZ translation:

#define TR_AUX_SERIAL_MODES "VYP\0 ""Telemetrie zrcadlení\0 ""Telemetrie vstup\0 ""SBUS Trenér\0 ""IBUS Trenér\0 ""CRSF Trenér\0 ""SUMD Trenér\0 ""LUA\0 ""CLI\0 ""GPS\0 ""Debug\0 "

@gagarinlg
Copy link
Member

closing, because this is replaced by #4102

@gagarinlg gagarinlg closed this Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request needs: testing rebase needed A git rebase on top of the latest destination branch version is required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CRSF input for Trainer mode Fix SBUS serial input Trainer-Input also via IBus and SumD
6 participants