Add rx device info frame as response to pings (#1021)
commitf0e79f743070586ec21632a14ea3394debc8b84c
authorJohannes <schugabe@gmx.at>
Thu, 28 Oct 2021 08:58:24 +0000 (28 10:58 +0200)
committerGitHub <noreply@github.com>
Thu, 28 Oct 2021 08:58:24 +0000 (28 10:58 +0200)
treea4d61503cf37ffb411d71076b8a91c066876e00c
parent8852ddae23f2f0cd4c3c1faf358cc236c2252ce5
Add rx device info frame as response to pings (#1021)

CRSF defines a message called CRSF_FRAMETYPE_DEVICE_PING. This message allows to ping all devices (also called broadcast) or a certain device. If a device receives a ping it should respond with a CRSF_FRAMETYPE_DEVICE_INFO message.

The tx module already responds to this message for the lua script support. With #997 our lua script also shows other devices but the rx did not get listed since it did not respond to the ping message.

This PR adds the device name for the rx targets and adds two responses to pings:

ping received from tx module (from the lua script): reply OTA
ping received from FC (needed for ardupilot): reply via UART

The method to generate the device info frame is moved in the crsf class and both tx+rx use the same method.
To inject the device info frame in the usual telemetry buffer a change in the logic was needed. The device info response of the FC would overwrite the device info response of the rx so the telemetry class makes sure that different buffers are used depending on the sender of a message.
46 files changed:
src/include/target/BETAFPV_2400_RX.h
src/include/target/BETAFPV_2400_TX.h
src/include/target/BETAFPV_900_TX.h
src/include/target/DIY_2400_RX_ESP8285_SX1280.h
src/include/target/DIY_2400_RX_STM32_CCG_Nano_v0_5.h
src/include/target/DIY_2400_TX_ESP32_SX1280_E28.h
src/include/target/DIY_2400_TX_ESP32_SX1280_LORA1280F27.h
src/include/target/DIY_2400_TX_ESP32_SX1280_Mini.h
src/include/target/DIY_2400_TX_ESP8285_SX1280.h
src/include/target/DIY_900_RX_ESP8285_SX127x.h
src/include/target/DIY_900_RX_HUZZAH_RFM95W.h
src/include/target/DIY_900_TX_ESP32_SX127x_E19.h
src/include/target/DIY_900_TX_ESP32_SX127x_RFM95.h
src/include/target/DIY_900_TX_TTGO_V1_SX127x.h
src/include/target/DIY_900_TX_TTGO_V2_SX127x.h
src/include/target/FM30_RX_MINI.h
src/include/target/FM30_TX.h
src/include/target/Frsky_RX_R9M.h
src/include/target/Frsky_TX_R9M.h
src/include/target/Frsky_TX_R9M_LITE.h
src/include/target/Frsky_TX_R9M_LITE_PRO.h
src/include/target/GHOST_2400_TX.h
src/include/target/GHOST_2400_TX_LITE.h
src/include/target/GHOST_ATTO_2400_RX.h
src/include/target/HGLRC_Hermes_2400_TX.h
src/include/target/HappyModel_ES24TX_2400_TX.h
src/include/target/HappyModel_ES24TX_Slim_Pro_2400_TX.h
src/include/target/HappyModel_TX_ES900TX.h
src/include/target/HappyModel_TX_ES915TX.h
src/include/target/MATEK_2400_RX.h
src/include/target/NamimnoRC_FLASH_2400_RX.h
src/include/target/NamimnoRC_FLASH_2400_TX.h
src/include/target/NamimnoRC_VOYAGER_900_ESP_RX.h
src/include/target/NamimnoRC_VOYAGER_900_RX.h
src/include/target/NamimnoRC_VOYAGER_900_TX.h
src/include/target/QuadKopters_JR_2400_TX.h
src/lib/CRSF/CRSF.cpp
src/lib/CRSF/CRSF.h
src/lib/CrsfProtocol/crsf_protocol.h
src/lib/LUA/lua.cpp
src/lib/Telemetry/telemetry.cpp
src/lib/Telemetry/telemetry.h
src/platformio.ini
src/src/rx_main.cpp
src/test/crsf_native/test_crsf.cpp [new file with mode: 0644]
src/test/telemetry_native/test_telemetry.cpp