> For the complete documentation index, see [llms.txt](https://docs.theseus.us/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.theseus.us/cyclops/autopilot-integration/optional-improvements/mavlink-osd-with-matek-h743.md).

# MAVLink OSD with Matek H743

<figure><img src="/files/t2boTEzgf29noMF6nqZ2" alt=""><figcaption></figcaption></figure>

Flashed with a custom ardupilot firmware, we can use the matek to draw the osd on the analog video feed using mavlink telemetry data from a cube orange plus rather than its own internal information.

Note that we hook up the vtx control pin to the cube orange plus so we can still control the vtx power with the rc.

### Custom ardupilot build

The matek needs a custom build of ardupilot to be able to display mavlink telem info on the osd. The cube does not need custom firmware.

{% file src="/files/8IDI8cCVNpZw87IfqNDY" %}

Flash your matek with this build then configure the parameters as follows:

| Parameter          |  Value | Purpose                                                           |
| ------------------ | -----: | ----------------------------------------------------------------- |
| `SYSID_THISMAV`    |   `42` | Keeps the Matek from using the same MAVLink system ID as the Cube |
| `OSD_TYPE`         |    `1` | Enables the onboard MAX7456/AT7456 analog OSD                     |
| `OSD_REM_ENABLE`   |    `1` | Enables remote MAVLink telemetry for OSD panels                   |
| `OSD_REM_SYSID`    |    `1` | Accepts telemetry from the Cube's MAVLink system ID               |
| `OSD_REM_TOUT`     | `1500` | Marks remote telemetry stale after 1500 ms                        |
| `SERIAL5_PROTOCOL` |    `2` | Enables MAVLink2 on the Matek `TX8/RX8` port                      |
| `SERIAL5_BAUD`     |   `57` | Sets the Matek `TX8/RX8` port to 57600 baud                       |

Reboot the Matek after changing serial parameters.

Feel free to use any serial port. I used TX8/RX8 because the others were broken on the matek I used.

### Cube Orange Plus Params

These params need to be changed on the cube orange for this to work. You can use any two serial ports on the cube, but you do need two separate serial ports, one sending telem data to the matek and one to control the vtx.

| Parameter          | Value | Purpose                          |
| ------------------ | ----: | -------------------------------- |
| `SERIAL2_PROTOCOL` |   `2` | MAVLink2 output on Cube `TELEM2` |
| `SERIAL2_BAUD`     |  `57` | 57600 baud to match the Matek    |

Set the Cube stream rates for the telemetry port wired to the Matek. For `TELEM2`, use:

| Parameter      | Value | Purpose                                 |
| -------------- | ----: | --------------------------------------- |
| `SR2_EXT_STAT` |   `5` | Sends battery and system-status data    |
| `SR2_EXTRA1`   |  `10` | Sends attitude and flight display data  |
| `SR2_EXTRA2`   |   `5` | Sends additional flight telemetry       |
| `SR2_POSITION` |   `5` | Sends global position and altitude data |
| `SR2_RAW_SENS` |   `2` | Sends GPS/sensor status data            |

And lastly ensure the cube is set up for vtx on:

| Parameter          | Value | Purpose                                       |
| ------------------ | ----: | --------------------------------------------- |
| `SERIAL3_PROTOCOL` |  `37` | Configure gps1 serial uart to control the vtx |
| `VTX_ENABLE`       |   `1` | Enable vtx control from cube                  |
| `RCx_OPTION`       |  `94` | Map vtx control to an rc switch               |

You might need to also configure `VTX_POWER` and `VTX_MAX_POWER` to allow for correct power switching.

### Nadir camera switching

{% hint style="warning" %}
This feature only works on custom, experimental builds of gryphon
{% endhint %}

You can also plug in the raspberry pi 5's j7 pins into the matek and configure it to switch between the front facing and nadir camera views.

Update this parameter on the orange cube plus:

| Parameter     | Value | Purpose                                            |
| ------------- | ----: | -------------------------------------------------- |
| `SR2_RC_CHAN` |  `10` | Sends rc information for vtx camera view switching |

Then update this on the matek:

| Parameter        | Value | Purpose                                              |
| ---------------- | ----: | ---------------------------------------------------- |
| `OSD_REM_CAM_CH` |   `7` | Which rc channel to look at for the camera switching |

The pi will send analog composite video on j7, and the matek will read the rc switched and update the displayed camera feed, c1 or c2, depending on if the switch is high or low.
