Skip to content

Comments

Make CRSF telemetry accessible over WIFI as UDP broadcast#211

Open
xNuclearSquirrel wants to merge 3 commits intoExpressLRS:masterfrom
xNuclearSquirrel:CRSF_TLM_UDP
Open

Make CRSF telemetry accessible over WIFI as UDP broadcast#211
xNuclearSquirrel wants to merge 3 commits intoExpressLRS:masterfrom
xNuclearSquirrel:CRSF_TLM_UDP

Conversation

@xNuclearSquirrel
Copy link

This PR adds access to CRSF telemetry over Wi-Fi, which currently only works for MAVLink while CRSF telemetry is only available over ESP-NOW.

This is a minimal implementation that broadcasts CRSF telemetry packets via UDP. It reuses the existing Wi-Fi/MAVLink networking path and uses mavlinkUDP.write() on MavlinkSendPort.

UDP broadcast is active when telemetry mode is set to WIFI in the ELRS Lua script.

This should not interfere with MAVLink in normal use, since CRSF and MAVLink telemetry are not used at the same time as far as I know. I could not test how it behaves with real ESP-NOW receivers since I don't have the hardware.

Previously, ESP-NOW was active whenever telemetry mode was not OFF (so even when set to WIFI). I kept this behavior in place and added UDP broadcast. The behavior is now:

  • WIFI: CRSF telemetry is sent via ESP-NOW and UDP broadcast.
  • ESP-NOW: CRSF telemetry is sent via ESP-NOW only.
  • OFF: no telemetry forwarding.

In my tests, this works in both AP and STA mode. I can receive the packets over UDP and parse/display telemetry fields successfully.

image

@xNuclearSquirrel
Copy link
Author

Oh and it works with GCS that support CRSF telemetry natively, such as MWPtools.
image

if (config.GetTelemMode() == BACKPACK_TELEM_MODE_WIFI)
{
sendMSPViaWiFiUDP(packet);
sendMSPViaEspnow(packet);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check it on my pocket, when in WIFI espnow packets are not send. So no need to keep this line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good to know. I left it in since it was like that previously, in case that was an intentional choice.

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.

2 participants