Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions docs/development/msp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
[81 - MSP_SET_BLACKBOX_CONFIG](#msp_set_blackbox_config)
[82 - MSP_TRANSPONDER_CONFIG](#msp_transponder_config)
[83 - MSP_SET_TRANSPONDER_CONFIG](#msp_set_transponder_config)
[84 - MSP_OSD_CONFIG](#msp_osd_config)
[85 - MSP_SET_OSD_CONFIG](#msp_set_osd_config)
[86 - MSP_OSD_CHAR_READ](#msp_osd_char_read)
[87 - MSP_OSD_CHAR_WRITE](#msp_osd_char_write)
[88 - MSP_VTX_CONFIG](#msp_vtx_config)
Expand Down Expand Up @@ -1391,63 +1389,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:

**Notes:** Not implemented in INAV `fc_msp.c`.

## <a id="msp_osd_config"></a>`MSP_OSD_CONFIG (84 / 0x54)`
**Description:** Retrieves OSD configuration settings and layout for screen 0. Coordinates are packed as `(Y << 8) | X`. When `USE_OSD` is not compiled in, only `osdDriverType` = `OSD_DRIVER_NONE` is returned.

**Request Payload:** **None**

**Reply Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `osdDriverType` | `uint8_t` | 1 | [osdDriver_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-osddriver_e) | Enum `osdDriver_e`: `OSD_DRIVER_MAX7456` if `USE_OSD`, else `OSD_DRIVER_NONE`. |
| `videoSystem` | `uint8_t` | 1 | [videoSystem_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-videosystem_e) | Enum `videoSystem_e`: Video system (Auto/PAL/NTSC) (`osdConfig()->video_system`). Sent even if OSD disabled |
| `units` | `uint8_t` | 1 | [osd_unit_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-osd_unit_e) | Enum `osd_unit_e` Measurement units (Metric/Imperial) (`osdConfig()->units`). Sent even if OSD disabled |
| `rssiAlarm` | `uint8_t` | 1 | % | RSSI alarm threshold (`osdConfig()->rssi_alarm`). Sent even if OSD disabled |
| `capAlarm` | `uint16_t` | 2 | mAh/mWh | Capacity alarm threshold (`currentBatteryProfile->capacity.warning`). Truncated to 16 bits. Sent even if OSD disabled. |
| `timerAlarm` | `uint16_t` | 2 | minutes | Timer alarm threshold in minutes (`osdConfig()->time_alarm`). Sent even if OSD disabled. |
| `altAlarm` | `uint16_t` | 2 | meters | Altitude alarm threshold (`osdConfig()->alt_alarm`). Sent even if OSD disabled |
| `distAlarm` | `uint16_t` | 2 | meters | Distance alarm threshold (`osdConfig()->dist_alarm`). Sent even if OSD disabled |
| `negAltAlarm` | `uint16_t` | 2 | meters | Negative altitude alarm threshold (`osdConfig()->neg_alt_alarm`). Sent even if OSD disabled |
| `itemPositions` | `uint16_t[OSD_ITEM_COUNT]` | OSD_ITEM_COUNT | packed | Packed X/Y position for each OSD item on screen 0 (`osdLayoutsConfig()->item_pos[0][i]`). Sent even if OSD disabled |

**Notes:** 1 byte if `USE_OSD` disabled; full payload (1 + fields + 2*OSD_ITEM_COUNT bytes) otherwise.

## <a id="msp_set_osd_config"></a>`MSP_SET_OSD_CONFIG (85 / 0x55)`
**Description:** Sets OSD configuration or a single item's position on screen 0.
#### Variant: `dataSize >= 10`

**Description:** dataSize >= 10

**Request Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `selector` | `uint8_t` | 1 | - | Must be 0xFF (-1) to indicate a configuration update. |
| `videoSystem` | `uint8_t` | 1 | [videoSystem_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-videosystem_e) | Enum `videoSystem_e`: Video system (Auto/PAL/NTSC) (`osdConfig()->video_system`). |
| `units` | `uint8_t` | 1 | [osd_unit_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-osd_unit_e) | Enum `osd_unit_e` Measurement units (Metric/Imperial) (`osdConfig()->units`). |
| `rssiAlarm` | `uint8_t` | 1 | % | RSSI alarm threshold (`osdConfig()->rssi_alarm`). |
| `capAlarm` | `uint16_t` | 2 | mAh/mWh | Capacity alarm threshold (`currentBatteryProfile->capacity.warning`). Truncated to 16 bits. |
| `timerAlarm` | `uint16_t` | 2 | minutes | Timer alarm threshold in minutes (`osdConfig()->time_alarm`). |
| `altAlarm` | `uint16_t` | 2 | meters | Altitude alarm threshold (`osdConfig()->alt_alarm`). |
| `distAlarm` | `uint16_t` | 2 | meters | Distance alarm threshold (`osdConfig()->dist_alarm`). Optional trailing field. |
| `negAltAlarm` | `uint16_t` | 2 | meters | Negative altitude alarm threshold (`osdConfig()->neg_alt_alarm`). Optional trailing field. |

**Reply Payload:** **None**

#### Variant: `dataSize == 3`

**Description:** Single item position update

**Request Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `itemIndex` | `uint8_t` | 1 | Index | Index of the OSD item to update (0 to `OSD_ITEM_COUNT - 1`). |
| `itemPosition` | `uint16_t` | 2 | packed | Packed X/Y position (`(Y << 8) | X`) for the specified item. |

**Reply Payload:** **None**


**Notes:** Requires `USE_OSD`. Distinguishes formats based on the first byte. Format 1 requires at least 10 bytes. Format 2 requires 3 bytes. Triggers an OSD redraw. See `MSP2_INAV_OSD_SET_*` for more advanced control.

## <a id="msp_osd_char_read"></a>`MSP_OSD_CHAR_READ (86 / 0x56)`
**Description:** Reads character data from the OSD font memory.

Expand Down
180 changes: 2 additions & 178 deletions docs/development/msp/msp_messages.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": {
"major": 2,
"minor": 1,
"major": 3,
"minor": 0,
"patch": 0
},
"messages": {
Expand Down Expand Up @@ -2433,182 +2433,6 @@
"notes": "Not implemented in INAV `fc_msp.c`.",
"description": "Set VTX Transponder settings."
},
"MSP_OSD_CONFIG": {
"code": 84,
"mspv": 1,
"replaced_by": ["MSP2_INAV_OSD_LAYOUTS", "MSP2_INAV_OSD_ALARMS", "MSP2_INAV_OSD_PREFERENCES"],
"request": null,
"reply": {
"payload": [
{
"name": "osdDriverType",
"ctype": "uint8_t",
"desc": "Enum `osdDriver_e`: `OSD_DRIVER_MAX7456` if `USE_OSD`, else `OSD_DRIVER_NONE`.",
"units": "Enum",
"enum": "osdDriver_e"
},
{
"name": "videoSystem",
"ctype": "uint8_t",
"desc": "Enum `videoSystem_e`: Video system (Auto/PAL/NTSC) (`osdConfig()->video_system`). Sent even if OSD disabled",
"units": "Enum",
"enum": "videoSystem_e"
},
{
"name": "units",
"ctype": "uint8_t",
"desc": "Enum `osd_unit_e` Measurement units (Metric/Imperial) (`osdConfig()->units`). Sent even if OSD disabled",
"units": "Enum",
"enum": "osd_unit_e"
},
{
"name": "rssiAlarm",
"ctype": "uint8_t",
"desc": "RSSI alarm threshold (`osdConfig()->rssi_alarm`). Sent even if OSD disabled",
"units": "%"
},
{
"name": "capAlarm",
"ctype": "uint16_t",
"desc": "Capacity alarm threshold (`currentBatteryProfile->capacity.warning`). Truncated to 16 bits. Sent even if OSD disabled.",
"units": "mAh/mWh"
},
{
"name": "timerAlarm",
"ctype": "uint16_t",
"desc": "Timer alarm threshold in minutes (`osdConfig()->time_alarm`). Sent even if OSD disabled.",
"units": "minutes"
},
{
"name": "altAlarm",
"ctype": "uint16_t",
"desc": "Altitude alarm threshold (`osdConfig()->alt_alarm`). Sent even if OSD disabled",
"units": "meters"
},
{
"name": "distAlarm",
"ctype": "uint16_t",
"desc": "Distance alarm threshold (`osdConfig()->dist_alarm`). Sent even if OSD disabled",
"units": "meters"
},
{
"name": "negAltAlarm",
"ctype": "uint16_t",
"desc": "Negative altitude alarm threshold (`osdConfig()->neg_alt_alarm`). Sent even if OSD disabled",
"units": "meters"
},
{
"name": "itemPositions",
"desc": "Packed X/Y position for each OSD item on screen 0 (`osdLayoutsConfig()->item_pos[0][i]`). Sent even if OSD disabled",
"ctype": "uint16_t",
"array": true,
"array_size": 0,
"array_size_define": "OSD_ITEM_COUNT",
"units": "packed"
}
]
},
"variable_len": true,
"notes": "1 byte if `USE_OSD` disabled; full payload (1 + fields + 2*OSD_ITEM_COUNT bytes) otherwise.",
"description": "Retrieves OSD configuration settings and layout for screen 0. Coordinates are packed as `(Y << 8) | X`. When `USE_OSD` is not compiled in, only `osdDriverType` = `OSD_DRIVER_NONE` is returned."
},
"MSP_SET_OSD_CONFIG": {
"code": 85,
"mspv": 1,
"replaced_by": ["MSP2_INAV_OSD_SET_LAYOUT_ITEM", "MSP2_INAV_OSD_SET_ALARMS", "MSP2_INAV_OSD_SET_PREFERENCES"],
"request": null,
"reply": null,
"notes": "Requires `USE_OSD`. Distinguishes formats based on the first byte. Format 1 requires at least 10 bytes. Format 2 requires 3 bytes. Triggers an OSD redraw. See `MSP2_INAV_OSD_SET_*` for more advanced control.",
"description": "Sets OSD configuration or a single item's position on screen 0.",
"variants": {
"dataSize >= 10": {
"description": "dataSize >= 10",
"request": {
"payload": [
{
"name": "selector",
"ctype": "uint8_t",
"desc": "Must be 0xFF (-1) to indicate a configuration update.",
"value": 255
},
{
"name": "videoSystem",
"ctype": "uint8_t",
"desc": "Enum `videoSystem_e`: Video system (Auto/PAL/NTSC) (`osdConfig()->video_system`).",
"units": "Enum",
"enum": "videoSystem_e"
},
{
"name": "units",
"ctype": "uint8_t",
"desc": "Enum `osd_unit_e` Measurement units (Metric/Imperial) (`osdConfig()->units`).",
"units": "Enum",
"enum": "osd_unit_e"
},
{
"name": "rssiAlarm",
"ctype": "uint8_t",
"desc": "RSSI alarm threshold (`osdConfig()->rssi_alarm`).",
"units": "%"
},
{
"name": "capAlarm",
"ctype": "uint16_t",
"desc": "Capacity alarm threshold (`currentBatteryProfile->capacity.warning`). Truncated to 16 bits.",
"units": "mAh/mWh"
},
{
"name": "timerAlarm",
"ctype": "uint16_t",
"desc": "Timer alarm threshold in minutes (`osdConfig()->time_alarm`).",
"units": "minutes"
},
{
"name": "altAlarm",
"ctype": "uint16_t",
"desc": "Altitude alarm threshold (`osdConfig()->alt_alarm`).",
"units": "meters"
},
{
"name": "distAlarm",
"ctype": "uint16_t",
"desc": "Distance alarm threshold (`osdConfig()->dist_alarm`). Optional trailing field.",
"units": "meters",
"optional": true
},
{
"name": "negAltAlarm",
"ctype": "uint16_t",
"desc": "Negative altitude alarm threshold (`osdConfig()->neg_alt_alarm`). Optional trailing field.",
"units": "meters",
"optional": true
}
]
},
"reply": null
},
"dataSize == 3": {
"description": "Single item position update",
"request": {
"payload": [
{
"name": "itemIndex",
"ctype": "uint8_t",
"desc": "Index of the OSD item to update (0 to `OSD_ITEM_COUNT - 1`).",
"units": "Index"
},
{
"name": "itemPosition",
"ctype": "uint16_t",
"desc": "Packed X/Y position (`(Y << 8) | X`) for the specified item.",
"units": "packed"
}
]
},
"reply": null
}
}
},
"MSP_OSD_CHAR_READ": {
"code": 86,
"mspv": 1,
Expand Down
50 changes: 0 additions & 50 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,26 +1367,6 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
break;
#endif

case MSP_OSD_CONFIG:
#ifdef USE_OSD
sbufWriteU8(dst, OSD_DRIVER_MAX7456); // OSD supported
// send video system (AUTO/PAL/NTSC)
sbufWriteU8(dst, osdConfig()->video_system);
sbufWriteU8(dst, osdConfig()->units);
sbufWriteU8(dst, osdConfig()->rssi_alarm);
sbufWriteU16(dst, currentBatteryProfile->capacity.warning);
sbufWriteU16(dst, osdConfig()->time_alarm);
sbufWriteU16(dst, osdConfig()->alt_alarm);
sbufWriteU16(dst, osdConfig()->dist_alarm);
sbufWriteU16(dst, osdConfig()->neg_alt_alarm);
for (int i = 0; i < OSD_ITEM_COUNT; i++) {
sbufWriteU16(dst, osdLayoutsConfig()->item_pos[0][i]);
}
#else
sbufWriteU8(dst, OSD_DRIVER_NONE); // OSD not supported
#endif
break;

case MSP_3D:
sbufWriteU16(dst, reversibleMotorsConfig()->deadband_low);
sbufWriteU16(dst, reversibleMotorsConfig()->deadband_high);
Expand Down Expand Up @@ -3105,36 +3085,6 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
#endif

#ifdef USE_OSD
case MSP_SET_OSD_CONFIG:
sbufReadU8Safe(&tmp_u8, src);
// set all the other settings
if ((int8_t)tmp_u8 == -1) {
if (dataSize >= 10) {
osdConfigMutable()->video_system = sbufReadU8(src);
osdConfigMutable()->units = sbufReadU8(src);
osdConfigMutable()->rssi_alarm = sbufReadU8(src);
currentBatteryProfileMutable->capacity.warning = sbufReadU16(src);
osdConfigMutable()->time_alarm = sbufReadU16(src);
osdConfigMutable()->alt_alarm = sbufReadU16(src);
// Won't be read if they weren't provided
sbufReadU16Safe(&osdConfigMutable()->dist_alarm, src);
sbufReadU16Safe(&osdConfigMutable()->neg_alt_alarm, src);
} else
return MSP_RESULT_ERROR;
} else {
// set a position setting
if ((dataSize >= 3) && (tmp_u8 < OSD_ITEM_COUNT)) // tmp_u8 == addr
osdLayoutsConfigMutable()->item_pos[0][tmp_u8] = sbufReadU16(src);
else
return MSP_RESULT_ERROR;
}
// Either a element position change or a units change needs
// a full redraw, since an element can change size significantly
// and the old position or the now unused space due to the
// size change need to be erased.
osdStartFullRedraw();
break;

case MSP2_INAV_OSD_UPDATE_POSITION: {
if (dataSize == 3) {
uint8_t item;
Expand Down
3 changes: 0 additions & 3 deletions src/main/msp/msp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@
#define MSP_TRANSPONDER_CONFIG 82 //out message Get transponder settings
#define MSP_SET_TRANSPONDER_CONFIG 83 //in message Set transponder settings

#define MSP_OSD_CONFIG 84 //DEPRECATED in INAV 9.1 - use MSP2_INAV_OSD_* instead. Will be removed in INAV 10.0
#define MSP_SET_OSD_CONFIG 85 //DEPRECATED in INAV 9.1 - use MSP2_INAV_OSD_* instead. Will be removed in INAV 10.0

#define MSP_OSD_CHAR_READ 86 //out message Get osd settings - betaflight
#define MSP_OSD_CHAR_WRITE 87 //in message Set osd settings - betaflight

Expand Down
Loading