Make MAVLink WiFi mode also emit ESPNOW CRSF GPS frames - #176
Open
MUSTARDTIGERFPV wants to merge 2 commits into
Open
Make MAVLink WiFi mode also emit ESPNOW CRSF GPS frames#176MUSTARDTIGERFPV wants to merge 2 commits into
MUSTARDTIGERFPV wants to merge 2 commits into
Conversation
|
This is a really cool idea. If I remember correctly, the Mfd mini crossbow needs gps and altitude. If I can get this working for the esp in the Nomad tx, it means I can run one elrs backpack esp32 on the mini crossbow and have the added bonus that Wi-Fi should work at the same time for mavlink to a GCS. |
pkendall64
force-pushed
the
mavlink-wifi-espnow-crsf
branch
4 times, most recently
from
June 29, 2026 06:35
351762e to
dba70ff
Compare
… be enough to make antenna trackers work) # Conflicts: # src/Tx_main.cpp
pkendall64
force-pushed
the
mavlink-wifi-espnow-crsf
branch
from
June 29, 2026 06:44
dba70ff to
26ace5e
Compare
ESP-NOW was only ever initialised in the non-WiFi branch of setup(), but BACKPACK_TELEM_MODE_WIFI sets StartWiFiOnBoot, so in MAVLink WiFi mode esp_now_send() ran against an uninitialised stack and returned ESP_ERR_ESPNOW_NOT_INIT. The return value was discarded, so the whole path looked healthy while nothing went out on air. Split the UID resolution out of SetSoftMACAddress() and move ESP-NOW bring-up into StartEspNow(), called from devWIFI once WiFi has settled -- it cannot run in setup() because startWiFi() takes the radio down again. Peers are re-bound if WiFi changes interface, since a station that fails to associate falls back to AP mode. Bind peers to the live interface on ESP32 (sending on the down STA interface in AP mode fails with ESP_ERR_ESPNOW_IF) and to the current channel on ESP8266 rather than a hardcoded 1. Log esp_now_send() failures so this cannot go silent again. Also fix the GPS frame itself: frame_size counts the payload plus type and crc, and crsf_sensor_gps_t was missing PACKED so sizeof() was 16 rather than the 15 bytes on the wire. Between them the crc byte was written over satcnt, which the AAT uses to decide when home is set. Use CRSF_FRAME_SIZE() and send telemetry with the 0xC8 sync byte that AatModule::onCrsfPacketIn expects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr: Take MAVLink frames with GPS data in them and also send them as CRSF/MSP/ESPNOW broadcast frames.
This should make antenna trackers (like the MFD stuff) work when in MAVLink mode running WiFi.