Adding header bytes to outgoing MAVLink messages

I’m experimenting with serial radios (e.g. Ebyte LoRa modules) for Ground Station to ArduCopter connection, over MAVLink 2. When in fixed transmission mode, these radios allow for addressable communication. That is, each radio has a two byte address, and outgoing messages can be targeted to a specific address.

So here’s the issue: each outgoing MAVLink message from the flight controller must include the two byte destination address at the start of the message, otherwise it doesn’t reach the GCS. I’d like to modify ArduCopter and make a custom firmware specifically for these radios… I’m having trouble finding where to add this in the code.

E.g. Drone => GCS: my Ground Station serial radio has address FF01, so my requirement is adding this to every outgoing MAVLink message on the flight controller: 0xFF 0x01 [full encoded MAVLink 2 message starting with 0xFD]

I found the code where the outgoing messages can be modified. In ArduCopter v4.3.7, check the function comm_send_buffer in GCS_MAVLink.cpp, the channel can have the custom header written there.