Solved...Frsky Telemetry - Custom Data from Flight Controller to D4R Receiver to Radio

Just sharing some helpful info…If you want to transmit data of any kind from the flight controller to the radio then keep reading.

Under AP_Frsky_Telem, look for AP_Frsky_D.cpp. This file has a send function. You can send any data you like via this function to the radio. You will notice there are Data IDs. You can repurpose any of these as needed. Then on the radio, under telemetry, you will find the custom data. Finally, you can use a lua script to intercept this data and display as needed.

You do need to create a hardware link from your flight controller to the D4R receiver. In my case, I was using a Pixhawk4 (F7 processor). In this case, you just need 1 wire from any UART port to the RX line on the D4R receiver then select the parameters → SerialX_Protocol=3 (D4R) and SerialX_Options=243 and SerialX_Baud=9.6k.

There are also functions for SPort and SPort Passthrough protocol in the same folder.