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

ExpressLRS support #1009

Closed
wants to merge 1 commit into from
Closed

ExpressLRS support #1009

wants to merge 1 commit into from

Conversation

phobos-
Copy link
Contributor

@phobos- phobos- commented Apr 15, 2021

This adds the same functionality as ExpressLRS LUA in DeviationTX:
https://github.com/ExpressLRS/ExpressLRS/blob/develop/src/lua/ELRS.lua

This code works with ExpressLRS v1.0.0-RC1 onwards.
Attached test binaries for Jumper T8SG V2 Plus.
Feedback is very much welcome.

(Note - only esp based ExpressLRS tx modules are supported -> -DUART_INVERTED needs to be commented out in user_defines.txt)
(Note2 - you need hardware CRSF mod in your radio in order for CRSF to work on the correct pin. Tutorial here: https://www.youtube.com/watch?v=Lr_YRGJl5x8)

deviation-t8sg_v2_plus-v5.0.0-1dc62dc.zip
deviation-t8sg_v2-v5.0.0-1dc62dc.zip

@Dropsleutel
Copy link

Hi Phobos,
I flashed your firmware in my tx, just to have a look.
just to mention I have no ESP 2.4ghz, only Frsky R9 I could test for you.
R9M module works in via PXX, as protocol it is inverted in deviation.
So CRSF output, it need to get inversion option in order to use inverted R9M in the back.

I see that firmware, nr c84450e it is excact same nr, as version i flashed in my Tx 30december2020.

There is no ELRS protocol in the list, but when selecting CRSF protocol, (note no module present in bay), I can see an empty menu, no txt, just yellow line which can be changed 4 positions up/down.

Thanks for all your great help and efforts !!
let me know if can help testing

@phobos-
Copy link
Contributor Author

phobos- commented Apr 16, 2021

Hi, thanks for the comment.
Hexfet went to hell and back to invert the PXX protocol :)
He basically implemented it as a bitbanged PWM:
https://github.com/DeviationTX/deviation/blob/master/src/target/tx/devo/common/protocol/pwm.c#L118

For CRSF it is different, it is a hardware UART implementation:
https://github.com/DeviationTX/deviation/blob/master/src/protocol/crsf_uart.c#L286

Deviation uses STM32F103RET6 at least for t8sg which I have on hand - that processor is incapable of inverting the UART signal in software, there are additional hardware inverters needed. That would not be the case if an F3 family was used.
What could be done from the software side is implementing a software serial communication similar to PXX, but then I don't think we would be able to achieve 400k baudrate speed required by CRSF protocol.

I actually also have an R9M module which I flashed and modded to work with ExpressLRS and Deviation, but I modded it in a way that only allows for one way communication between the module and TX. What it means is you can only send stick information to the module, but you will not receive any communication back, like configuration data, telemetry, etc. If you still want to do the mod you can refer to the short tutorial I posted on RCGroups:
https://www.rcgroups.com/forums/showthread.php?3437865-ExpressLRS-DIY-LoRa-based-race-optimized-RC-link-system/page13#post46673237

You will be able to use ExpressLRS gear, but still this Pull Request will not help you, you will see a blank page.

With ESP based module module, you can invert/uninvert the signal on the module side via software. Communication to and from the module would then work as expected, and the CRSF protocol menu should look like this:
wx_camera_1618475875234

@dat-alex
Copy link

dat-alex commented Apr 16, 2021

I have recompiled source for the 2400_TX_ESP32_SX1280_E28_via_UART (-DUART_INVERTED be commented out in user_defines.txt)
BUT I have not eps32 TX module available to test
SO THIS IS NOT TESTED!
I will upload here for someone to test.

DIY_2400_TX_ESP32_SX1280_E28_via_UART.zip

(this way you have not to do the 'dirty work' of installing Visual Studio, settings ,for compiling etc....)

@Dropsleutel
Copy link

@phobos

And what about the R9M, i assume there is an hardware inverter onboard?
Maybe bridging or bypassing it ? Direct feed to the uart pin at R9M cpu?

The resistor mod and alos the temperature issues in R9M were serial comms are affected, maybe we could also get rid off as bot bit of strange issues....

Is there any shematic of R9M or the Happymodel 868?

@tonvfx
Copy link

tonvfx commented Apr 29, 2021

Hey!

This is great. Would it be possible to also do a build for the V2 non-plus? The Carbon T8SG uses that firmware. Thanks!

@phobos-
Copy link
Contributor Author

phobos- commented Apr 29, 2021

@tonvfx

deviation-t8sg_v2-v5.0.0-575ef03.zip

@ghost
Copy link

ghost commented May 3, 2021

with diy esp-01f+sx127x 868mhz it works fine

https://github.com/ExpressLRS/ExpressLRS/wiki/Building-an-Esp-Rx#custom-esp-900-mhz-rx

@tonvfx
Copy link

tonvfx commented May 4, 2021

@tonvfx

deviation-t8sg_v2-v5.0.0-575ef03.zip

That's awesome!! Thanks.. As soon as my module arrives I'll get going with this. Thank you very much!

@tonvfx
Copy link

tonvfx commented May 15, 2021

@tonvfx

deviation-t8sg_v2-v5.0.0-575ef03.zip

Got it up and running. Nice one.

@ghost
Copy link

ghost commented May 15, 2021

Thats great, have you tried on fligth allready? mine fell a loot more reactive...

@phobos- phobos- changed the title Implemented ExpressLrs support ExpressLRS support May 18, 2021
@phobos-
Copy link
Contributor Author

phobos- commented May 18, 2021

I pushed a small bugfix that caused the menus to glitch sometimes. Builds are updated in the first (top) comment.
If anyone is interested in a build for a different target - shout here, I'll upload it 😅

@jviticofpv
Copy link

Hello my friends...

I would like a little help over here, just to be clear that my Jumper/RadioMaster TX8 (deviation-t8sg_v2) would work ok with Happymodel 2.4Ghz TX/RX combo.

- In order to make it work I must do the next steps??

1- Crossfire pin mod.
2- Flash this firmware ((deviation-t8sg_v2-v5.0.0-1dc62dc.zip))
3- Update Tx and Rx via WIFI with my pc
4- and that's it??

I would appreciate your help.... not understanding what to do... it's what have me with my purchase on hold.

Thanks in advance from Chile (Venezuelan guy)

@Thomas-Lawford
Copy link

Hi, I installed the firmware and completed the hardware mod, but I was wondering:
do I need to add a LUA script? -if yes where in the files am I supposed to add it, and where can I get this script?

@phobos-
Copy link
Contributor Author

phobos- commented May 23, 2021

@jviticofpv yes, that's it, just remember to flash Happymodel tx with -DUART_INVERTED commented out :
#-DUART_INVERTED

@phobos-
Copy link
Contributor Author

phobos- commented May 23, 2021

@Thomas-Lawford no need, just follow the same steps as @jviticofpv described in the comment above yours.
All config params should be available under CRSF protocol menu.

@jviticofpv
Copy link

jviticofpv commented May 23, 2021

@jviticofpv yes, that's it, just remember to flash Happymodel tx with -DUART_INVERTED commented out :
#-DUART_INVERTED

perfect.... but this part is what I don't understand. I'm sorry to insist, but could you tell me where to get the "how to" about this part.... specially the "comment out part"...

if this means that I must do some coding? (installing coding software)?
or just get the happymodel firmware, look for "USER_DEFINES.TXT" file, and comment out with # the line that you mention?

if is like this last part (I'll hope) will. be perfect, because I know that I can do it 😅😅..

thanks again for your help...

@phobos-
Copy link
Contributor Author

phobos- commented May 23, 2021

@jviticofpv You can use the ExpressLRS configurator to flash the firmware:
https://www.youtube.com/watch?v=XpCvYpyQ4LM&ab_channel=KaijuKaiju
https://www.youtube.com/watch?v=wBUamLm51XQ&ab_channel=UAVTechUAVTech

here are two examples, there are many more tutorials on youtube.
Finally, if you'll still have trouble with flashing expresslrs stuff you can hop on discord, there are many knowledgable people that can help with specific issues:
https://discord.com/invite/dS6ReFY

@jviticofpv
Copy link

@jviticofpv You can use the ExpressLRS configurator to flash the firmware:
https://www.youtube.com/watch?v=XpCvYpyQ4LM&ab_channel=KaijuKaiju
https://www.youtube.com/watch?v=wBUamLm51XQ&ab_channel=UAVTechUAVTech

here are two examples, there are many more tutorials on youtube.
Finally, if you'll still have trouble with flashing expresslrs stuff you can hop on discord, there are many knowledgable people that can help with specific issues:
https://discord.com/invite/dS6ReFY

thanks so much.... I'm already purchased my expresslrs setup... thanks for clarify my doubts....

@tonvfx
Copy link

tonvfx commented May 25, 2021

I pushed a small bugfix that caused the menus to glitch sometimes. Builds are updated in the first (top) comment.
If anyone is interested in a build for a different target - shout here, I'll upload it 😅

Hey! I just flashed this to my radio, seemed fine.. except, when I accidentally switched to sbus and back to crsf the menu was gone. I had to load another model, switch off the radio, switch on, reload elrs and it was back. Also, I doesn't look like wifi update is working on MacOs.. Chrome stalls at 17% and then wifi is lost... which brings me to another question, is there a way for me to see what version of expresslrs I'm running on my radio? ("version" in the menu would be nice..)

Thanks for the awesome work!

@howels
Copy link

howels commented May 26, 2021

I pushed a small bugfix that caused the menus to glitch sometimes. Builds are updated in the first (top) comment.
If anyone is interested in a build for a different target - shout here, I'll upload it 😅

Hey! I just flashed this to my radio, seemed fine.. except, when I accidentally switched to sbus and back to crsf the menu was gone. I had to load another model, switch off the radio, switch on, reload elrs and it was back. Also, I doesn't look like wifi update is working on MacOs.. Chrome stalls at 17% and then wifi is lost... which brings me to another question, is there a way for me to see what version of expresslrs I'm running on my radio? ("version" in the menu would be nice..)

Thanks for the awesome work!

Wait for eLRS 1.1, it'll arrive soon and will work using the same code as existing CRSF support in deviation nightly builds. No need for the special build above (which is probably causing the issue you report with menus). No idea why WiFi update doesn't work- please report on eLRS GitHub.

Edit- the lua menu changes are now planned for 2.x cos they're incompatible with prior 1.x menu code.

@tonvfx
Copy link

tonvfx commented May 26, 2021

I pushed a small bugfix that caused the menus to glitch sometimes. Builds are updated in the first (top) comment.
If anyone is interested in a build for a different target - shout here, I'll upload it 😅

Hey! I just flashed this to my radio, seemed fine.. except, when I accidentally switched to sbus and back to crsf the menu was gone. I had to load another model, switch off the radio, switch on, reload elrs and it was back. Also, I doesn't look like wifi update is working on MacOs.. Chrome stalls at 17% and then wifi is lost... which brings me to another question, is there a way for me to see what version of expresslrs I'm running on my radio? ("version" in the menu would be nice..)
Thanks for the awesome work!

Wait for eLRS 1.1, it'll arrive soon and will work using the same code as existing CRSF support in deviation nightly builds. No need for the special build above (which is probably causing the issue you report with menus). No idea why WiFi update doesn't work- please report on eLRS GitHub.

Wait? Haha.. with something this exciting? ;-) .. But that's really good to hear. I'll ask about the wifi update 'issue' on the elrs github/ discord... Like I said.. it's also possible it does work, but there's (in deviationtx at least atm) not an easy way to check version running on the tx afaik....

@ghost
Copy link

ghost commented May 26, 2021

I pushed a small bugfix that caused the menus to glitch sometimes. Builds are updated in the first (top) comment.
If anyone is interested in a build for a different target - shout here, I'll upload it 😅

Hey! I just flashed this to my radio, seemed fine.. except, when I accidentally switched to sbus and back to crsf the menu was gone. I had to load another model, switch off the radio, switch on, reload elrs and it was back. Also, I doesn't look like wifi update is working on MacOs.. Chrome stalls at 17% and then wifi is lost... which brings me to another question, is there a way for me to see what version of expresslrs I'm running on my radio? ("version" in the menu would be nice..)
Thanks for the awesome work!

Wait for eLRS 1.1, it'll arrive soon and will work using the same code as existing CRSF support in deviation nightly builds. No need for the special build above (which is probably causing the issue you report with menus). No idea why WiFi update doesn't work- please report on eLRS GitHub.

Wait? Haha.. with something this exciting? ;-) .. But that's really good to hear. I'll ask about the wifi update 'issue' on the elrs github/ discord... Like I said.. it's also possible it does work, but there's (in deviationtx at least atm) not an easy way to check version running on the tx afaik....

Well.. i think if update dont work and it work on rx, they cant bind if both dont have same version..

@Dropsleutel
Copy link

Dropsleutel commented Jul 5, 2021

Just to inform I had r9m running in t8sg v2 plus fine. (inc telemetry) (modified the tray)
I flashed my r9m with ELRS firmware and it runs in OpenTx radio.
Now I connected as such;

r9m_backpack_pins

I connected Rx1, to the CPPM pin. (and removed the transistor)
I connected Tx Alternative location to Smartport pin.

I flashed https://github.com/DeviationTX/deviation/files/6503349/deviation-t8sg_v2_plus-v5.0.0-1dc62dc.zip

However in CRSF menu, I get an empty bar which I can move up and down.
I don't see any Txt or data in the menus.

@howels
Copy link

howels commented Jul 7, 2021

Just to inform I had r9m running in t8sg v2 plus fine. (inc telemetry) (modified the tray)
I flashed my r9m with ELRS firmware and it runs in OpenTx radio.
Now I connected as such;

r9m_backpack_pins

I connected Rx1, to the CPPM pin. (and removed the transistor)
I connected Tx Alternative location to Smartport pin.

I flashed https://github.com/DeviationTX/deviation/files/6503349/deviation-t8sg_v2_plus-v5.0.0-1dc62dc.zip

However in CRSF menu, I get an empty bar which I can move up and down.
I don't see any Txt or data in the menus.

Did you change the UART inversion when building eLRS? Setting for T8SG is opposite of OpenTX.

@Dropsleutel
Copy link

I used R9M. Inversion is only availble for DIY ESP?

However I connected direct to tx rx pins as by picture above, so it should bypass the Frsky invertors on the pcb of the R9M ?

@Teiho69
Copy link

Teiho69 commented Sep 3, 2021

Just flashed my T8SG v2 carbon with deviation-t8sg_v2-v5.0.0-575ef03 .
My Happymodel ES900 tx works like a charm, so do my TBS Tracer tx.
I'm glad that CSRF support for TBS Tx is not lost.
Thank you really much.

@kotyatokino
Copy link

I'm using carbon T8SG with deviation-t8sg_v2-v5.0.0-575ef03.zip and ELRS1.0-1.1 works fine.
But new 1.2 is not shown on CRSF menu. blank lines.
Just only updated ELRS 1.2 without another changes from working 1.1 environment.
Then I revert back to 1.1 and working fine now.
Can we use ELRS 1.2 with this firmware?

@howels
Copy link

howels commented Oct 27, 2021

I'm using carbon T8SG with deviation-t8sg_v2-v5.0.0-575ef03.zip and ELRS1.0-1.1 works fine. But new 1.2 is not shown on CRSF menu. blank lines. Just only updated ELRS 1.2 without another changes from working 1.1 environment. Then I revert back to 1.1 and working fine now. Can we use ELRS 1.2 with this firmware?

What is your device name? Names > 12 characters don't render properly in DeviationTX.

@phobos-
Copy link
Contributor Author

phobos- commented Oct 27, 2021

@kotyatokino I am currently adding support for v1.2 to spi rx, I will take a look at deviationtx side after bf side is done 😅 Please stick to v1.1 for the time being.

@howels
Copy link

howels commented Oct 27, 2021

@kotyatokino I am currently adding support for v1.2 to spi rx, I will take a look at deviationtx side after bf side is done sweat_smile Please stick to v1.1 for the time being.

If you know where the device name length limits are in DeviationTX that would be awesome to fix @phobos- , myself and @StonedDawg hunted for that and couldn't see where the 12 char limit is set.

@kotyatokino
Copy link

Thank you very much for your comments.

@howels

What is your device name? Names > 12 characters don't render properly in DeviationTX.
I know this issue, and my dev name only 4 chars.

@phobos-
Got it. Thank you for your effort.

@phobos-
Copy link
Contributor Author

phobos- commented Oct 28, 2021

@kotyatokino I was able to reproduce your issue, looks like ExpressLRS/ExpressLRS#897 breaks compatibility with deviationTX. I will look into it.

@kotyatokino
Copy link

kotyatokino commented Oct 29, 2021

@phobos-
I just pulled your codes.
My poor miss understanding was.
crsf_uart.c > CRSF_Cmds(enum ProtoCmds cmd) > Model.proto_opts[PROTO_OPTS_RF_FREQ]
was changed from TX module. because PROTO_OPTS_RF_FREQ is getting from tx module.

But the value didn't get from TX module by crashed. I clearly understand current situation.
The code was merged to ELRS, so we need to wait the release 1.3 is better I think.

BTW, Do you have debug and build instruction page for deviation tx? DO you know the instruction availabe?

@kotyatokino
Copy link

Hmm... I didn't understand everything.
ExpressLRS/ExpressLRS#897 's code is already merged with 1.2 release...
We already compiled this fix, but it's not solved now.

@phobos-
Copy link
Contributor Author

phobos- commented Oct 29, 2021

@kotyatokino this change is what BREAKS it, not fixes it. I removed this line from expresslrs code, compiled & flashed my ExpressLRS TX module and it started working again.

I changed:
CRSF::duplex_set_TX(); -> //CRSF::duplex_set_TX();

@Dropsleutel
Copy link

Hi guys still to get back to use cases for the old red R9M's in T8SG still laying around covered in dust;

Anybody tried to hook up the external R9M UART Port into bay of T8SGV2 Plus ? Change ExpressLRS targets.h the RC pins to that port , so we should get rid of any nasty invertors ?

#define GPIO_PIN_RCSIGNAL_RX PA10
#define GPIO_PIN_RCSIGNAL_TX PA9


#elif defined(TARGET_R9M_TX) || defined(TARGET_TX_ES915TX)

#define GPIO_PIN_RFamp_APC1 PA6 //APC2 is connected through a I2C dac and is handled elsewhere
#define GPIO_PIN_RFswitch_CONTROL PB3 //HIGH = RX, LOW = TX

#define GPIO_PIN_NSS PB12
#define GPIO_PIN_DIO0 PA15
#define GPIO_PIN_MOSI PB15
#define GPIO_PIN_MISO PB14
#define GPIO_PIN_SCK PB13
#define GPIO_PIN_RST PC14
#define GPIO_PIN_RX_ENABLE GPIO_PIN_RFswitch_CONTROL
#define GPIO_PIN_TX_ENABLE GPIO_PIN_RFamp_APC1
#define GPIO_PIN_SDA PB7
#define GPIO_PIN_SCL PB6
#define GPIO_PIN_RCSIGNAL_RX PB11 // not yet confirmed
#define GPIO_PIN_RCSIGNAL_TX PB10 // not yet confirmed
#define GPIO_PIN_LED_RED PA11 // Red LED
#define GPIO_PIN_LED_GREEN PA12 // Green LED
#define GPIO_PIN_BUTTON PA8 // pullup e.g. LOW when pressed
#define GPIO_PIN_BUZZER PB1
#define GPIO_PIN_DIP1 PA12 // dip switch 1
#define GPIO_PIN_DIP2 PA11 // dip switch 2
#define GPIO_PIN_FAN_EN PB9 // Fan mod https://github.com/AlessandroAU/ExpressLRS/wiki/R9M-Fan-Mod-Cover

#define GPIO_PIN_DEBUG_RX PA10 // confirmed
#define GPIO_PIN_DEBUG_TX PA9 // confirmed

#define GPIO_PIN_BUFFER_OE PA5 //CONFIRMED
#define GPIO_PIN_BUFFER_OE_INVERTED 0
#define GPIO_PIN_DIO1 PA1 //Not Needed, HEARTBEAT pin

#define DAC_I2C_ADDRESS 0b0001100
#define DAC_IN_USE 1

Shall I test it with latest code ? Deviation ExpressLRS code ?

@kotyatokino
Copy link

@kotyatokino this change is what BREAKS it, not fixes it. I removed this line from expresslrs code, compiled & flashed my ExpressLRS TX module and it started working again.

I changed: CRSF::duplex_set_TX(); -> //CRSF::duplex_set_TX();

Thank you for your explation.
CRSF::duplex_set_TX() will break the way to CRSF_Cmds().
We need to find reason why . I will try it with my poor understanding.

@kotyatokino
Copy link

hmmm.. I just giving up debugging...
When we see debug print , I need to buy phono plug UART converter cable..

@howels
Copy link

howels commented Nov 5, 2021

hmmm.. I just giving up debugging... When we see debug print , I need to buy phono plug UART converter cable..

Yes, it's the most awkward debug system. I thought the same thing.

@Dropsleutel
Copy link

I just gave it a re-try T8SG V2 Plus, with R9M ExpressLRS flashed, but the CRSF menu is not working for me.

@dat-alex
Copy link

Hi ! I 've just received my new HappyModel elrs 2.4 Tx module and trying it with T8SG plus .I get the classic problem with blankCRSF menus.
Is there any Deviation fw build compatible with ELRS F4 2G4 AIO Flight Controller spi receiver already compiled for the plus with OLED (like Phobos no-OLED)?

Thank you for your time
Alex

@howels
Copy link

howels commented Nov 26, 2021

Hi ! I 've just received my new HappyModel elrs 2.4 Tx module and trying it with T8SG plus .I get the classic problem with blankCRSF menus. Is there any Deviation fw build compatible with ELRS F4 2G4 AIO Flight Controller spi receiver already compiled for the plus with OLED (like Phobos no-OLED)?

Thank you for your time Alex

Try this #1018 (comment)

@harlock00999
Copy link

Hi, First things first, thank you all for trying to keep Deviationtx alive and usable with ELRS! It is thanks to this post if I'm able to use a HGLRC TX 2.4Ghz on my beloved T8SG V2 PLUS! - THANK YOU ALL - (@phobos- you're the best)

Now, as many of you I was stuck with fw 1.1 since I read that 1.2 wasn't good yet.

But yesterday I flashed my tx with ELSR fw version 1.2.1 and everything seem to work just fine. The only bug I noticed is the power value that you can add on the main page of your model freeze sometimes and come back if you go in the model setup and re-int the CRFS module. Other values like LQ, RSSI work fine on both radio and Betaflight.

Thoughts? Questions? Comments? Do you want me to do some tests?
Please keep in mind that I'm just a user...well, a smart user if you will ^_^

Thank you guys and happy flying

@StonedDawg
Copy link
Contributor

@harlock00999 elrs stable V2 has been released, please use V2, and this PR from Phobos for your deviationtx
Phobos deviationtx for elrs V2

@harlock00999
Copy link

@harlock00999 elrs stable V2 has been released, please use V2, and this PR from Phobos for your deviationtx
Phobos deviationtx for elrs V2

I'm going right now!!! Thank you!

kkbin505 added a commit to kkbin505/Arduino-Transmitter-for-ELRS that referenced this pull request Jan 4, 2022
Based on the deviation pull for T8SG elrs setup menu.
This change implement the setup package, you have to manually setup the code. And press button to update the setup in the TX module.
Optimization needed to remove the press operation.
DeviationTX/deviation#1009
@phobos-
Copy link
Contributor Author

phobos- commented Jan 4, 2022

closing this, as expresslrs v2.0 is natively supported in deviationTX.

@phobos- phobos- closed this Jan 4, 2022
@howels
Copy link

howels commented Jan 5, 2022

closing this, as expresslrs v2.0 is natively supported in deviationTX.

There's still the 12 character limit, which many users struggle with. I'm using -DDEVICE_NAME to compile my eLRS TX with a shorter name, but would be great if the CRSF code could just concat fields to 12 chars instead of rendering a blank line.

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.