ExpressLRS / Backpack

Firmware for ExpressLRS compatible backpacks
GNU General Public License v3.0
100 stars 73 forks source link

Re-architect mavlink UDP forwarder #154

Closed wvarty closed 3 months ago

wvarty commented 3 months ago

This PR does a number of things:

  1. It extracts the majority of the mavlink parsing code out from the devWifi lib, and moves it into the mavlink lib, which is a much more fitting place for it.
  2. The original implementation used a special mavlink cmd msg to tell the backpack that we are using mavlink mode on the TX. This was flaky, because it injected itself into a running mavlink serial stream without checking if a packet was already in-flight. This meant that sometimes the message was unsuccessful, and the backpack could be set to the wrong mode. The message has now been moved to MSP, which is handled reliably in between mavlink packets.
  3. The original implementation monitored the Link Mode option from the main firmware, and if the user changed the TX to mavlink, it set the backpack to boot to wifi for UDP forwarding. It also detected mavlink heartbeats and auto-triggered wifi UDP forwarding. This has all been removed, so that we can decide to send telem to a receiver via ESPNOW, or to bluetooth (future).
  4. The telem mode of the backpack is now controlled in LUA via the Backpack->Telemetry option, which has 3 states (as of this PR): Off = don't foward telem at all ESPNOW = forwards the telem stream (either CRSF or mavlink, depending on what the TX is getting from the craft) to the tx-backpack, and then on to the backpack receiver via ESPNOW (for trackers etc, like the sentinel integration). This prevents the mavlink data from triggering the wifi. NOTE: Only CRSF is supported in this PR. A future PR is incoming for forwarding mavlink. WiFi = forward telem to the TX-backpack, and trigger wifi for UDP forwarding.
  5. This PR also removes the /logging web endpoint, which was rarely used as a dev debugging tool
  6. It also fixes a bug where the backpack no longer responded with the version string because it jumped straight to wifi if in mavlink mode.
jonasniesner commented 3 months ago

I don't know if this is relevant but this PR(+ the associated main project PR) works on my hardware TX: RM16S RX: Betafpv SuperD 2.4GHz FC: Ardupilot

hyp0dermik-code commented 3 months ago

image

LGTM, Zorro/Rp4TD @ 3e07de8

wvarty commented 3 months ago

@JyeSmith @pkendall64 @MUSTARDTIGERFPV Are we waiting on anything else here? PR has been tested by a few people now, and all the requested code changes have been made... whats the hold up on getting this ticked?