olliw42 / mLRS

2.4 GHz & 915/868 MHz & 433 MHz/70 cm LoRa based telemetry and radio link for remote controlled vehicles
GNU General Public License v3.0
279 stars 58 forks source link

esp, add mavlink params, add esp82xx tx support, add tx-generic-2400-pa target #154

Open olliw42 opened 3 months ago

olliw42 commented 3 months ago

as the title says, this PR does 3 thiongs, separated in 3 commits:

tested to compile for all targets tested to work on speedybee receiver as tx (with no com, no debug, no in, no jrpin5, only with serial)(debug I did also test)

note: I made a change in esp-rxclock.h, which is inspired by the finding that initializing MS_C with 0 did not start the timer for tx. It's a bug, and clear from the ISR, which first increases CNT, so that the following if check never gets true. In the case of the old rxclock.h this didn't bite since Reset() was called in Init.

Not all edge cases may be fully worked out yet, especially with the param support. So let's consider this WIP, and it's here for you to see, and maybe (hopefully) also to play with.

The intention is to use a pair of ELRS receivers as SiK replacement. This was possible already with the FrsKy receivers, since these provide additional pins, which could be used for in & out. The challenge with the ELRS receivers is that they only have Tx,Rx.

rotorman commented 3 months ago

Just as an info regarding the above Express LRS receiver ports limitation: the RadioMaster RP4TD (with ESP32) has 2 accessible serial ports: https://www.radiomasterrc.com/products/rp4td-expresslrs-2-4ghz-diversity-receiver

olliw42 commented 3 months ago

Just as an info regarding the above Express LRS receiver ports limitation: the RadioMaster RP4TD (with ESP32) has 2 accessible serial ports: https://www.radiomasterrc.com/products/rp4td-expresslrs-2-4ghz-diversity-receiver

YES ... that's why I bought it :D :D :D

we currently however have only esp82xx working stable, and many other ELRS receivers don't have these pads, and the speedybee is just half the price ...

in some sense it's also just to start getting into tx, and I wanted to try this mavlink params thing for a while :)

tmcadam commented 3 months ago

This is very cool!! How would I send a mavlink command to change a tx or rx param?

olliw42 commented 3 months ago

I have tested it with MissionPlanner ... sadly MP has a bit it's weirednesses, but when knowing and respecting them it's not so bad

have rx and tx connected, on the serial of the tx attach a usb-ttl adapter and connect to MissionPlanner, now connect in MissionPlanner, and you should see now TWO components, one the fight ontroller, and one the tx module (show up as telemetry radio). Select, the radio, go to parameter page, and click "refresh params", this should download the parameters

tmcadam commented 3 months ago

I have tested with 2 x generic 900 rx and is working very nicely. Very cool!!!!

image

Only issue I can see is some inconsistent behavior around the led being off or on when bound i.e. sometimes its off, sometimes it is on.

Also, are the options and description able to be defined, so they are visible in MP parameter list?

This is really a good entry to the TX game. I will try and run this now on esp32 tx 2400 hardware.

olliw42 commented 3 months ago

COOL! THX for testing!

Only issue I can see is some inconsistent behavior around the led being off or on when bound i.e. sometimes its off, sometimes it is on.

what do you mean? you enter bind and the led does not blink?

Also, are the options and description able to be defined, so they are visible in MP parameter list?

AFAIK yes, but not soo easily. Maybe we should re-research. (I had proposed a generic MAVLink way many years ago, but sadly it never took off)

tmcadam commented 3 months ago

COOL! THX for testing!

Only issue I can see is some inconsistent behavior around the led being off or on when bound i.e. sometimes its off, sometimes it is on.

what do you mean? you enter bind and the led does not blink?

Also, are the options and description able to be defined, so they are visible in MP parameter list?

AFAIK yes, but not soo easily. Maybe we should re-research. (I had proposed a generic MAVLink way many years ago, but sadly it never took off)

When bound, sometimes the led is solid on, sometimes it is solid off. The blinking is fine.

olliw42 commented 3 months ago

what do you mean with "bound" ??? it should be always bound to establish a connection in the first place also, led behavior should be independent on this mavlink thing

usually, if led changes from solid to something else, it means that the tx-rx disconnect. is this that, is your link not stably connected?

tmcadam commented 3 months ago

what do you mean with "bound" ??? it should be always bound to establish a connection in the first place also, led behavior should be independent on this mavlink thing

usually, if led changes from solid to something else, it means that the tx-rx disconnect. is this that, is your link not stably connected?

Sorry, I didn't explain well. If I switch on the tx and rx switched off, then it blinks slowly. I switch on the rx, the blinking stops and the led goes off. But the tx and rx are connected, working fine, just led is off (should be on in this state).

olliw42 commented 3 months ago

If I switch on the tx and rx switched off, then it blinks slowly. I switch on the rx, the blinking stops and the led goes off. But the tx and rx are connected, working fine, just led is off (should be on in this state).

ah, looks like a bug ... has nothing to do with mavlink params, right?

tmcadam commented 3 months ago

If I switch on the tx and rx switched off, then it blinks slowly. I switch on the rx, the blinking stops and the led goes off. But the tx and rx are connected, working fine, just led is off (should be on in this state).

ah, looks like a bug ... has nothing to do with mavlink params, right?

Correct

Also, LQ was good 100% 0 packets lost in MP

olliw42 commented 3 months ago

this is really strange just looked at the led code, and I can't see anything which would explain this. Also, I can't see why it should be different for the tx than it is for the rx. The rx's led works as expected, right?

If I switch on the tx and rx switched off, then it blinks slowly. I switch on the rx, the blinking stops and the led goes off.

Is this repeatable, i.e., is it always so that when you first power up the tx and then th erx, the led on the tx goes from blink to off? Implication, when you first power up rx and then tx, led goes to on. Or is this more random?

olliw42 commented 3 months ago

Sorry, I didn't explain well. If I switch on the tx and rx switched off, then it blinks slowly. I switch on the rx, the blinking stops and the led goes off. But the tx and rx are connected, working fine, just led is off (should be on in this state).

I cannot reproduce it, and I also cannot see anything in the code which would suggest this.

I start to think this is not a LED thing but some other problem with your system.