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
Add Spektrum satellite serial protocol #2419
base: master
Are you sure you want to change the base?
Add Spektrum satellite serial protocol #2419
Conversation
84a590f
to
ae47974
Compare
Skookum SK 720 is I believe another example. |
ae47974
to
e7553ce
Compare
e7553ce
to
fe54465
Compare
I believe my changes are mostly ready for review. There are two things that I especially would like to hear your opinions about.
|
All EdgeTX/OpenTX based radios allow the remapping of the channels. I'm not a big fan of providing a hard-coded mapping like that. I think we need to provide the ability to remap the channels in the receiver as this will help with other protocols like SBUS where there are certain gyro stabilisers that insist on having the channels in a particular order as well. For the naming I'm not too fussed, as long as the users know what it means I'm ok with it. I'll get around to doing an actual review soon. |
src/lib/LUA/rx_devLUA.cpp
Outdated
static struct luaItem_selection luaSatelliteSystem = { | ||
{"Satellite System", CRSF_TEXT_SELECTION}, | ||
0, // value | ||
"DSMX 11MS;DSMX 22MS;DSM2 11MS;DSM2 22MS", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know if Im a huge fan of an extra rx lua option just for this. We could add each option to luaSerialProtocol
the same way we have sbus and inverted sbus?
How common are all 4 protocols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know much about SBUS but I believe "SBUS" and "Inverted SBUS" are two incompatible protocols. For example, if the FC expects "SBUS" but we choose "Inverted SBUS", it won't work. The main difference is, all these options are compatible (maybe with the exception of DSM2 22MS, I believe Betaflight separates these as Spektrum1024 and Spektrum2048, the former for DSM2 22MS and the latter for the rest). So if you choose "DSMX 11MS" or "DSMX 22MS", it is still the same protocol and expected the work the same, just with a longer update duration.
The most commons are DSMX ones while the least common ones are DSM2 ones. However, as far as I see, all DSMX Spektrum satellites are backwards compatible with DSM2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the luaSatelliteSystem lua option and add these to luaSerialProtocol, it means we can later use the 2 extra bits in the Config to expand serialProtocol from 16 to 64. I think this be better long term.
Is there any harm in just having the 11ms option e.g. some hardware currently in use that does not accept 11ms? 22ms is painfully slow for ELRS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having only DSMX 11MS would be fine probably. I just wanted to give users the freedom to emulate any valid configuration available out there, especially since it basically just takes a couple of if-statements once we have the base implementation. Also, I think 50Hz option is not too much faster than 22ms, doesn't change the fact that it is painfully slow though.
fe54465
to
2a8feb1
Compare
Don't these FCs/gyros also support SBUS and/or PWM input? Both of which are already supported by ELRS. |
Yes, they both do. The SK720 needed an adapter for sbus, that was probably just a hardware inverter. |
/*Channel 1*/ 2, | ||
/*Channel 2*/ 0, | ||
/*Channel 3*/ 3, | ||
/*Channel 4*/ 11, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is channel 5 mapped to 11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many FCs that use satellite receivers use the 5th channel for various things like flight mode selection, pitch for helicopters etc. A 2 position switch in channel 5 may not be enough for many users, especially when it is tied to arming. I mapped channel 5 to 11 at the output to give users as many general purpose outputs as possible at the lower channels. However, as I indicated in my very first message, I am open to suggestions related to mapping, since as @pkendall64 pointed out, mapping would be useful for SBUS too.
b223f95
to
f0310f6
Compare
f0310f6
to
3855206
Compare
I rebased the changes, removed the channel mapping as I believe it requires a more generic and flexible solution, and renamed the protocol to its official name in the configuration UIs. |
3855206
to
ce97c17
Compare
Maybe dumb question: this is not SRXL protocol but something else they just use for communication between satellite and main receiver? |
Yes, this is not SRXL. If you are familiar with Betaflight, these changes implement the SPEKTRUM1024 and SPEKTRUM2048 protocols. These "satellite" receivers could be connected to the flight controllers directly or could be connected to receivers that have PWM outputs (Like Spektrum AR8000). I believe the protocol is obsolete for Spektrum, however, any flight controller I've seen out there has support for it because of its simplicity. |
src/lib/LUA/rx_devLUA.cpp
Outdated
@@ -25,7 +25,7 @@ static const char *rxModes = "50Hz;60Hz;100Hz;160Hz;333Hz;400Hz;10kHzDuty;On/Off | |||
static struct luaItem_selection luaSerialProtocol = { | |||
{"Protocol", CRSF_TEXT_SELECTION}, | |||
0, // value | |||
"CRSF;Inverted CRSF;SBUS;Inverted SBUS;SUMD;DJI RS Pro;HoTT Telemetry;Spektrum Satellite", | |||
"CRSF;Inverted CRSF;SBUS;Inverted SBUS;SUMD;DJI RS Pro;HoTT Telemetry;Spektrum Remote Receiver", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you aware that on BW screens only about 12 characters will be seen so maybe "Spektrum RR"? also as mentioned previously (AFAIRC) why not just move all DSM~ entries here, like it is with CRSF, SBUS?
ce97c17
to
fa245a3
Compare
I was finally able to get back to this. As suggested multiple times, I moved the DSM* entries with the other protocols instead of having an extra rx lua option and rebased my changes. |
a6794c3
to
1993cd7
Compare
1993cd7
to
e00bd09
Compare
Updated the changes with the new signature of the sendRCFrame function. |
e00bd09
to
7f164c3
Compare
Introduction:
This PR intends to add support for a serial protocol used by some Spektrum satellite receivers to ExpressLRS receivers. Also this is my first contribution to this project and I am pretty new to the entire ExpressLRS ecosystem. So, please let me know if there are details that I overlooked.
PR content:
This PR allows ExpressLRS receivers to communicate with flight controllers using a protocol used by some Spektrum satellite receivers, such as SPM9745. The details of the protocol is defined here: https://www.spektrumrc.com/ProdInfo/Files/Remote%20Receiver%20Interfacing%20Rev%20A.pdf
An entry called "Spektrum Satellite" is added to the serial protocol options of the receivers to allow users to choose this protocol. This protocol has different versions that vary with data resolution (10-bit or 12-bit) and channel update duration (22 ms and 11 ms). Users can choose the version of the protocol they want their receivers to operate in using an option menu added in this PR. Currently, it is missing the necessary Web UI changes but the LUA script could be used for changing these settings.
Since the channels used in Spektrum systems and ExpressLRS systems do not map one-to-one, this PR implements a simple, static channel mapping within the protocol implementation. For example, this implementation maps the 3rd channel (seems to be used for throttle by default) of the ExpressLRS to the 1st channel (throttle) of the Spektrum satellite protocol. I am actually not sure if this is necessary since the channel input sources seem to be highly configurable in EdgeTX with TX16S radio. So, for example, users may want to assign the throttle stick as the input source for the first channel in their radio instead of using this mapping. Unfortunately, I do not know if the other radios in the ecosystem give a similar flexibility. However, this mapping is necessary for the 5th channel since it does not have a special meaning in Spektrum systems. This implementation maps it to the last available channel (12) in the satellite protocol to allow users to use a wider range of values in channel 5. Channel 5 is usually used in flight controllers for various things like changing the flight modes, setting gyro gains etc.
Example use cases:
If a flight controller does not support the Crossfire protocol to communicate with a receiver, but it supports the Spektrum satellite protocol, the ExpressLRS receiver can be connected to the port that would have been used for a Spektrum satellite receiver and the ExpressLRS receiver could use the protocol implemented in this PR to communicate with the flight controller. The flight controller used in GooSky S2 would be a good example for such flight controllers.