Center ARMED message and stats (#12086)
[betaflight.git] / docs / API / DisplayPort.md
blobe0d7c66f07197053e2aa8044178601b40105a536
1 # DisplayPort MSP Extensions
3 Betaflight supports what is sometimes referred to as Canvas Mode whereby the OSD can send arbitrary character strings to be displayed at given screen coordinates.
5 ## DisplayPort MSP commands
7 ### MSP\_SET\_OSD\_CANVAS
9 The MSP\_SET\_OSD\_CANVAS command is sent by the VTX, or display device, to the FC to indicate the size of the canvas available to the DisplayPort rendering when in HD mode. HD mode, as is indicated by `vcd_video_system = HD` is automatically set on reception of this command.
11 | Command | Msg Id | Direction | Notes |
12 |---------|--------|-----------|-------|
13 | MSP\_SET\_OSD\_CANVAS | 188 | to FC | Sets the canvas size|
15 | Data | Type | Notes |
16 |------|------|-------|
17 | canvas_cols | uint8 | The number of columns |
18 | canvas_rows | uint8 | The number of rows |
20 ### MSP\_OSD\_CANVAS
22 The MSP\_OSD\_CANVAS command is sent by the configurator to the FC to determine the size of the canvas available to the DisplayPort rendering when in HD mode. This is then used on the OSD tab to show the correct number of rows/columns when editing the OSD element positions.
24 | Command | Msg Id | Direction | Notes |
25 |---------|--------|-----------|-------|
26 | MSP\_OSD\_CANVAS | 189 | to FC | Gets the canvas size|
28 Response is two bytes.
30 | Data | Type | Notes |
31 |------|------|-------|
32 | canvas_cols | uint8 | The number of columns |
33 | canvas_rows | uint8 | The number of rows |
35 ### MSP\_DISPLAYPORT
37 The MSP\_DISPLAYPORT command is sent by the FC to the display device/VTX to perform a DisplayPort operation.
39 | Command | Msg Id | Direction | Notes |
40 |---------|--------|-----------|-------|
41 | MSP\_DISPLAYPORT | 182 | from FC | DisplayPort specific commands follow |
43 One of the following sub-commands will then follow.
45 ## DisplayPort sub-commands
48 #### MSP\_DP\_HEARTBEAT
49 | Command | Msg Id | Notes |
50 |---------|--------|-------|
51 | MSP\_DP\_HEARTBEAT | 0 | Prevent OSD Slave boards from displaying a 'disconnected' status |
53 #### MSP\_DP\_RELEASE
54 | Command | Msg Id | Notes |
55 |---------|--------|-------|
56 | MSP\_DP\_RELEASE | 1 | Clears the display and allows local rendering on the display device based on telemetry informtation etc. |
58 #### MSP\_DP\_CLEAR\_SCREEN
59 | Command | Msg Id | Notes |
60 |---------|--------|-------|
61 | MSP\_DP\_CLEAR\_SCREEN | 2 | Clear the display |
63 #### MSP\_DP\_WRITE\_STRING
64 | Command | Msg Id | Notes |
65 |---------|--------|-------|
66 | MSP\_DP\_WRITE\_STRING | 3 | Write a string |
68 | Data | Type | Notes |
69 |------|------|-------|
70 | row | uint8 | Row on which to position the first character of the string |
71 | column | uint8 | Column on which to position the first character of the string |
72 | attribute | uint8 | Byte indicating the font to use and if the text should flash |
73 | string | uint8 x n | NULL terminated string of up to 30 characters in length |
75 The `attribute` parameter is encoded thus.
77 | Field | Bits | Comment |
78 | ----- | ---- | ------- |
79 | Version | 7 | Must be 0 |
80 | DISPLAYPORT\_MSP\_ATTR\_BLINK | 6 | Set to have the display device automatically blink the string |
81 | Reserved | 2 - 5 | Must be 0 |
82 | Font number | 0 - 1 | Selects one of four fonts, each of 256 8 bit characters |
84 #### MSP\_DP\_DRAW\_SCREEN
85 | Command | Msg Id | Notes |
86 |---------|--------|-------|
87 | MSP\_DP\_DRAW\_SCREEN | 4 | Triggers the display of a frame after it has been cleared/rendered |
89 #### MSP\_DP\_OPTIONS
90 | Command | Msg Id | Notes |
91 |---------|--------|-------|
92 | MSP\_DP\_OPTIONS | 5 | Not used by Betaflight. Used by INAV and Ardupilot to set display resolution. |
94 #### MSP\_DP\_SYS
95 | Command | Msg Id | Notes |
96 |---------|--------|-------|
97 | MSP\_DP\_SYS | 6 | Display system element displayportSystemElement_e at given coordinates |
99 | Data | Type | Notes |
100 |------|------|-------|
101 | row | uint8 | Row on which to position the first character of the string |
102 | column | uint8 | Column on which to position the first character of the string |
103 | system_element | uint8 | System element to be rendered by the VTX/goggle/display device |
105 `system_element` will be one of the following as defined by `displayPortSystemElement_e `. Once one MSP\_DP\_SYS sub-command has been received by the VTX/goggle/display device then the default system elements should no longer be displayed in their default locations, but only explicitly as directed by this command. In this way, the default behaviour is as before, but as soon as any system element is explicitly positioned these OSD elements behave just like any other and can be called up is specific locations by any given OSD profile.
108 // System elements rendered by VTX or Goggles
109 typedef enum {
110     DISPLAYPORT_SYS_GOGGLE_VOLTAGE = 0,
111     DISPLAYPORT_SYS_VTX_VOLTAGE = 1,
112     DISPLAYPORT_SYS_BITRATE = 2,
113     DISPLAYPORT_SYS_DELAY = 3,
114     DISPLAYPORT_SYS_DISTANCE = 4,
115     DISPLAYPORT_SYS_LQ = 5,
116     DISPLAYPORT_SYS_GOGGLE_DVR = 6,
117     DISPLAYPORT_SYS_VTX_DVR = 7,
118     DISPLAYPORT_SYS_WARNINGS = 8,
119     DISPLAYPORT_SYS_VTX_TEMP = 9,
120     DISPLAYPORT_SYS_FAN_SPEED = 10,
121     DISPLAYPORT_SYS_COUNT,
122 } displayPortSystemElement_e;