Adding mavlink statustext to FrSky passthrough telemetry

So I’ve been messing around with companion MCUs/Computers and ArduPilot. One of the things that I would like to do is send a statustext message from the companion machine to the flight computer and have that message then be piped down through the FrSky passthrough telemetry. The Frsky telemetry code already has the capability to send a statustext to the Tx. So I started noodling around with the code, which was my first foray into editing and compiling ArduPilot, and found the section of the code that handles the status text from an outside source (or at least I think that is the piece of code) in the /libraries/GCS_MAVLink/GCS_Common.cpp file. I thought that adding a call to the frsky.queue_message function to that handle_statustext function would move the text to the passthrough telemetry stream. I should point out that I do see the message in mission planner, so I know that much is working, but I do not know how it is getting to mission planner.

I set up my machine to compile Ardupilot and made the code adjustment and got a compilation error. The error was that frsky is not declared but in the same file it is declared, I lack the Kung Fu to make sense of this.

I decided then to write a feature request to add this functionality but before hitting submit, I decided to give it a go in the forums.

I am looking for wisdom on finding a way to get the statustext sent via MAVLink from a companion computer to be routed to the FrSky Passthrough Telmetry. I have appended the feature request below and you can see where I simply added the the frsky function.


Feature request

Is your feature request related to a problem? Please describe.
Mavlink status text from external sources (companion computers) are not routed to the FrSky passthrough telemetry.

Describe the solution you’d like
I would like that properly formatted Mavlink status text that originate from a source other than the flight computer or GCS to be routed to the FrSky passthrough telemetry stream.

Describe alternatives you’ve considered
I have not considered any alternatives, but I did attempt to adjust the GCS_MAVLINK::handle_statustext function in /libraries/GCS_MAVLink/GCS_Common.cpp (lines 2681 to lines 2708ish) to include a call to the frsky.queue_message function. Alas, this failed to compile because “frsky was not declared…” See below:

void GCS_MAVLINK::handle_statustext(mavlink_message_t *msg)
    AP_Logger *df = AP_Logger::get_singleton();
    if (df == nullptr) {

    mavlink_statustext_t packet;
    mavlink_msg_statustext_decode(msg, &packet);
    const uint8_t max_prefix_len = 20;
    const uint8_t text_len = MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1+max_prefix_len;
    char text[text_len] = { 'G','C','S',':'};
    uint8_t offset = strlen(text);

    if (msg->sysid != sysid_my_gcs()) {
        offset = hal.util->snprintf(text,

    memcpy(&text[offset], packet.text, MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN);
	frsky.queue_message(7, text);


I lack the Kung Fu at the moment to attempt any further attempts at compilation.

[ ] All
[ ] AntennaTracker
[ X ] Copter
[ X ] Plane
[ X ] Rover
[ ] Submarine

Have you opened a github issue? You could ask for advice with the code on gitter, or open a work in progress pull request to ask for help with.

No, not yet. I figured I would try the forums first, but it’s ready to go as you can see.

Thanks for the tips, I will look into it.

Any luck with this feature? I need to use something similar,