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
45 changes: 45 additions & 0 deletions docs/development/msp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
[8744 - MSP2_INAV_TIMESYNC](#msp2_inav_timesync)
[8752 - MSP2_INAV_SET_AUX_RC](#msp2_inav_set_aux_rc)
[8753 - MSP2_INAV_WIND](#msp2_inav_wind)
[8754 - MSP2_INAV_MAG_UNALIGNED](#msp2_inav_mag_unaligned)
[8755 - MSP2_INAV_ESC_SRXL2_STATUS](#msp2_inav_esc_srxl2_status)
[8756 - MSP2_INAV_ESC_SRXL2_CALIBRATE](#msp2_inav_esc_srxl2_calibrate)
[12288 - MSP2_BETAFLIGHT_BIND](#msp2_betaflight_bind)
[12289 - MSP2_RX_BIND](#msp2_rx_bind)

Expand Down Expand Up @@ -5002,6 +5005,48 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:

**Notes:** Requires `USE_WIND_ESTIMATOR`; returns zeroes when wind estimation is not compiled in or not yet valid. Check bit 0 of `flags` before using speed/angle values.

## <a id="msp2_inav_mag_unaligned"></a>`MSP2_INAV_MAG_UNALIGNED (8754 / 0x2232)`
**Description:** Retrieves the calibrated compass reading in the sensor's own frame, before the board and sensor alignment are applied.

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

**Reply Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `magX` | `int16_t` | 2 | Raw units | Compass X reading with zero offset and gain calibration applied, before any alignment rotation (`mag.magADCUnaligned[X]`). 0 if `USE_MAG` is not defined |
| `magY` | `int16_t` | 2 | Raw units | Compass Y reading, as `magX` |
| `magZ` | `int16_t` | 2 | Raw units | Compass Z reading, as `magX` |

**Notes:** Always answers with 6 bytes; they are zero on targets built without `USE_MAG`.

## <a id="msp2_inav_esc_srxl2_status"></a>`MSP2_INAV_ESC_SRXL2_STATUS (8755 / 0x2233)`
**Description:** Reports the Spektrum Smart ESC (SRXL2) link and the state of its throttle range calibration.

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

**Reply Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `calibrationPhase` | `uint8_t` | 1 | [srxl2CalPhase_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-srxl2calphase_e) | Where the throttle range calibration is (`srxl2MotorCalibrationPhase()`): 0 off, 1 full throttle waiting for the ESC to power up, 2 holding high while the ESC takes the endpoint, 3 low, 4 high driven by hand, 5 low driven by hand |
| `linked` | `uint8_t` | 1 | Boolean | 1 if every SRXL2 port has an ESC that completed its handshake and was heard within the link timeout (`srxl2MotorIsConnected()`), otherwise 0 |
| `lastCalibrationResult` | `uint8_t` | 1 | [srxl2CalResult_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-srxl2calresult_e) | Why the last request to start a calibration was refused, or 0 if it was not (`srxl2MotorCalibrationLastResult()`): 1 armed, 2 no SRXL2 port, 3 battery connected, 4 no battery voltage sensor |
| `portCount` | `uint8_t` | 1 | Count | SRXL2 ports opened (`srxl2MotorCount()`) |
| `motorCount` | `uint8_t` | 1 | Count | Motors the mixer wants (`getMotorCount()`). Arming is refused while this is more than `portCount` |

**Notes:** Requires `USE_MOTOR_SRXL2`. `lastCalibrationResult` exists because `MSP2_INAV_ESC_SRXL2_CALIBRATE` has no reply to carry a refusal reason in.

## <a id="msp2_inav_esc_srxl2_calibrate"></a>`MSP2_INAV_ESC_SRXL2_CALIBRATE (8756 / 0x2234)`
**Description:** Starts, drives or aborts the SRXL2 throttle range calibration.

**Request Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `phase` | `uint8_t` | 1 | [srxl2CalPhase_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-srxl2calphase_e) | What to do (`srxl2CalPhase_e`): 0 abort, 1 start the unattended sequence, 4 drive high by hand, 5 drive low by hand. Other values are refused |

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

**Notes:** Requires `USE_MOTOR_SRXL2`. Fails when the driver refuses: armed, no SRXL2 port, battery already connected for the unattended sequence, or no voltage sensor to detect the ESC powering up. `MSP2_INAV_ESC_SRXL2_STATUS` reports which. Phases 1 and 4 command full throttle with the aircraft disarmed; both end on a timeout, and arming cancels any phase.

## <a id="msp2_betaflight_bind"></a>`MSP2_BETAFLIGHT_BIND (12288 / 0x3000)`
**Description:** Initiates the receiver binding procedure for supported serial protocols (CRSF, SRXL2).

Expand Down
92 changes: 91 additions & 1 deletion docs/development/msp/msp_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": {
"major": 2,
"minor": 1,
"patch": 1
"patch": 2
},
"messages": {
"MSP_API_VERSION": {
Expand Down Expand Up @@ -11897,6 +11897,96 @@
"notes": "Requires `USE_WIND_ESTIMATOR`; returns zeroes when wind estimation is not compiled in or not yet valid. Check bit 0 of `flags` before using speed/angle values.",
"description": "Retrieves the estimated horizontal wind speed and direction from the internal wind estimator."
},
"MSP2_INAV_MAG_UNALIGNED": {
"code": 8754,
"mspv": 2,
"request": null,
"reply": {
"payload": [
{
"name": "magX",
"ctype": "int16_t",
"desc": "Compass X reading with zero offset and gain calibration applied, before any alignment rotation (`mag.magADCUnaligned[X]`). 0 if `USE_MAG` is not defined",
"units": "Raw units"
},
{
"name": "magY",
"ctype": "int16_t",
"desc": "Compass Y reading, as `magX`",
"units": "Raw units"
},
{
"name": "magZ",
"ctype": "int16_t",
"desc": "Compass Z reading, as `magX`",
"units": "Raw units"
}
]
},
"notes": "Always answers with 6 bytes; they are zero on targets built without `USE_MAG`.",
"description": "Retrieves the calibrated compass reading in the sensor's own frame, before the board and sensor alignment are applied."
},
"MSP2_INAV_ESC_SRXL2_STATUS": {
"code": 8755,
"mspv": 2,
"request": null,
"reply": {
"payload": [
{
"name": "calibrationPhase",
"ctype": "uint8_t",
"desc": "Where the throttle range calibration is (`srxl2MotorCalibrationPhase()`): 0 off, 1 full throttle waiting for the ESC to power up, 2 holding high while the ESC takes the endpoint, 3 low, 4 high driven by hand, 5 low driven by hand",
"units": "Enum",
"enum": "srxl2CalPhase_e"
},
{
"name": "linked",
"ctype": "uint8_t",
"desc": "1 if every SRXL2 port has an ESC that completed its handshake and was heard within the link timeout (`srxl2MotorIsConnected()`), otherwise 0",
"units": "Boolean"
},
{
"name": "lastCalibrationResult",
"ctype": "uint8_t",
"desc": "Why the last request to start a calibration was refused, or 0 if it was not (`srxl2MotorCalibrationLastResult()`): 1 armed, 2 no SRXL2 port, 3 battery connected, 4 no battery voltage sensor",
"units": "Enum",
"enum": "srxl2CalResult_e"
},
{
"name": "portCount",
"ctype": "uint8_t",
"desc": "SRXL2 ports opened (`srxl2MotorCount()`)",
"units": "Count"
},
{
"name": "motorCount",
"ctype": "uint8_t",
"desc": "Motors the mixer wants (`getMotorCount()`). Arming is refused while this is more than `portCount`",
"units": "Count"
}
]
},
"notes": "Requires `USE_MOTOR_SRXL2`. `lastCalibrationResult` exists because `MSP2_INAV_ESC_SRXL2_CALIBRATE` has no reply to carry a refusal reason in.",
"description": "Reports the Spektrum Smart ESC (SRXL2) link and the state of its throttle range calibration."
},
"MSP2_INAV_ESC_SRXL2_CALIBRATE": {
"code": 8756,
"mspv": 2,
"request": {
"payload": [
{
"name": "phase",
"ctype": "uint8_t",
"desc": "What to do (`srxl2CalPhase_e`): 0 abort, 1 start the unattended sequence, 4 drive high by hand, 5 drive low by hand. Other values are refused",
"units": "Enum",
"enum": "srxl2CalPhase_e"
}
]
},
"reply": null,
"notes": "Requires `USE_MOTOR_SRXL2`. Fails when the driver refuses: armed, no SRXL2 port, battery already connected for the unattended sequence, or no voltage sensor to detect the ESC powering up. `MSP2_INAV_ESC_SRXL2_STATUS` reports which. Phases 1 and 4 command full throttle with the aircraft disarmed; both end on a timeout, and arming cancels any phase.",
"description": "Starts, drives or aborts the SRXL2 throttle range calibration."
},
"MSP2_BETAFLIGHT_BIND": {
"code": 12288,
"mspv": 2,
Expand Down
Loading