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
20 changes: 2 additions & 18 deletions docs/development/msp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
[107 - MSP_COMP_GPS](#msp_comp_gps)
[108 - MSP_ATTITUDE](#msp_attitude)
[109 - MSP_ALTITUDE](#msp_altitude)
[110 - MSP_ANALOG](#msp_analog)
[111 - MSP_RC_TUNING](#msp_rc_tuning)
[113 - MSP_ACTIVEBOXES](#msp_activeboxes)
[114 - MSP_MISC](#msp_misc)
Expand Down Expand Up @@ -1960,21 +1959,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
| `variometer` | `int16_t` | 2 | cm/s | Estimated vertical speed (`getEstimatedActualVelocity(Z)`) |
| `baroAltitude` | `int32_t` | 4 | cm | Latest raw altitude from barometer (`baroGetLatestAltitude()`). 0 if `USE_BARO` disabled |

## <a id="msp_analog"></a>`MSP_ANALOG (110 / 0x6e)`
**Description:** Provides analog sensor readings: battery voltage, current consumption (mAh), RSSI, and current draw (Amps).

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

**Reply Payload:**
|Field|C Type|Size (Bytes)|Units|Description|
|---|---|---|---|---|
| `vbat` | `uint8_t` | 1 | 0.1V | Battery voltage, scaled (`getBatteryVoltage() / 10`), constrained 0-255 |
| `mAhDrawn` | `uint16_t` | 2 | mAh | Consumed battery capacity (`getMAhDrawn()`), constrained 0-65535 |
| `rssi` | `uint16_t` | 2 | 0-1023 or % | Received Signal Strength Indicator (`getRSSI()`). Units depend on source |
| `amperage` | `int16_t` | 2 | 0.01A | Current draw (`getAmperage()`), constrained -32768 to 32767 |

**Notes:** Superseded by `MSP2_INAV_ANALOG` which provides higher precision and more fields.

## <a id="msp_rc_tuning"></a>`MSP_RC_TUNING (111 / 0x6f)`
**Description:** Retrieves RC tuning parameters (rates, expos, TPA) for the current control rate profile.

Expand Down Expand Up @@ -2206,7 +2190,7 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
| `batteryState` | `uint8_t` | 1 | [batteryState_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-batterystate_e) | Enum `batteryState_e` Current battery state (`getBatteryState()`, see `BATTERY_STATE_*`) |
| `vbatActual` | `uint16_t` | 2 | 0.01V | Actual battery voltage (`getBatteryVoltage()`) |

**Notes:** Only available if `USE_DJI_HD_OSD` or `USE_MSP_DISPLAYPORT` is defined. Some values are duplicated from `MSP_ANALOG` / `MSP2_INAV_ANALOG` but potentially with different scaling/types.
**Notes:** Only available if `USE_DJI_HD_OSD` or `USE_MSP_DISPLAYPORT` is defined. Some values are duplicated from `MSP2_INAV_ANALOG` but potentially with different scaling/types.

## <a id="msp_vtxtable_band"></a>`MSP_VTXTABLE_BAND (137 / 0x89)`
**Description:** Retrieves information about a specific VTX band from the VTX table. (Implementation missing in provided `fc_msp.c`)
Expand Down Expand Up @@ -3172,7 +3156,7 @@ When the MSP JSON specification changes, bump `msp_messages.json` version:
**Notes:** Requires `USE_OPFLOW`.

## <a id="msp2_inav_analog"></a>`MSP2_INAV_ANALOG (8194 / 0x2002)`
**Description:** Provides detailed analog sensor readings, superseding `MSP_ANALOG` with higher precision and additional fields.
**Description:** Provides detailed analog sensor readings with higher precision and additional fields.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/development/msp/msp-message-routing-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
- MSP_BOARD_INFO - Hardware identification
- MSP_STATUS / MSP_STATUS_EX - Flight controller status
- MSP_SENSOR_STATUS - Sensor health status
- MSP_ANALOG - Battery/voltage readings
- MSP2_INAV_ANALOG - Battery/voltage readings
- MSP_ATTITUDE - Current attitude (roll/pitch/yaw)
- MSP_ALTITUDE - Altitude readings
- MSP_RAW_GPS - GPS data
Expand Down
44 changes: 4 additions & 40 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 @@ -3928,42 +3928,6 @@
"notes": "",
"description": "Provides estimated altitude, vertical speed (variometer), and raw barometric altitude."
},
"MSP_ANALOG": {
"code": 110,
"mspv": 1,
"replaced_by": ["MSP2_INAV_ANALOG"],
"request": null,
"reply": {
"payload": [
{
"name": "vbat",
"ctype": "uint8_t",
"desc": "Battery voltage, scaled (`getBatteryVoltage() / 10`), constrained 0-255",
"units": "0.1V"
},
{
"name": "mAhDrawn",
"ctype": "uint16_t",
"desc": "Consumed battery capacity (`getMAhDrawn()`), constrained 0-65535",
"units": "mAh"
},
{
"name": "rssi",
"ctype": "uint16_t",
"desc": "Received Signal Strength Indicator (`getRSSI()`). Units depend on source",
"units": "0-1023 or %"
},
{
"name": "amperage",
"ctype": "int16_t",
"desc": "Current draw (`getAmperage()`), constrained -32768 to 32767",
"units": "0.01A"
}
]
},
"notes": "Superseded by `MSP2_INAV_ANALOG` which provides higher precision and more fields.",
"description": "Provides analog sensor readings: battery voltage, current consumption (mAh), RSSI, and current draw (Amps)."
},
"MSP_RC_TUNING": {
"code": 111,
"mspv": 1,
Expand Down Expand Up @@ -4602,7 +4566,7 @@
}
]
},
"notes": "Only available if `USE_DJI_HD_OSD` or `USE_MSP_DISPLAYPORT` is defined. Some values are duplicated from `MSP_ANALOG` / `MSP2_INAV_ANALOG` but potentially with different scaling/types.",
"notes": "Only available if `USE_DJI_HD_OSD` or `USE_MSP_DISPLAYPORT` is defined. Some values are duplicated from `MSP2_INAV_ANALOG` but potentially with different scaling/types.",
"description": "Provides battery state information, formatted primarily for DJI FPV Goggles compatibility."
},
"MSP_VTXTABLE_BAND": {
Expand Down Expand Up @@ -6957,7 +6921,7 @@
]
},
"notes": "Requires `USE_CURRENT_METER`/`USE_ADC` for current-related fields; values fall back to zero when unavailable. Capacity fields are reported in the units configured by `batteryMetersConfig()->capacity_unit` (mAh or mWh).",
"description": "Provides detailed analog sensor readings, superseding `MSP_ANALOG` with higher precision and additional fields."
"description": "Provides detailed analog sensor readings with higher precision and additional fields."
},
"MSP2_INAV_MISC": {
"code": 8195,
Expand Down
7 changes: 0 additions & 7 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,13 +767,6 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
#endif
break;

case MSP_ANALOG:
sbufWriteU8(dst, (uint8_t)constrain(getBatteryVoltage() / 10, 0, 255));
sbufWriteU16(dst, (uint16_t)constrain(getMAhDrawn(), 0, 0xFFFF)); // milliamp hours drawn from battery
sbufWriteU16(dst, getRSSI());
sbufWriteU16(dst, (int16_t)constrain(getAmperage(), -0x8000, 0x7FFF)); // send amperage in 0.01 A steps, range is -320A to 320A
break;

case MSP2_INAV_ANALOG:
// Bit 1: battery full, Bit 2: use capacity threshold, Bit 3-4: battery state, Bit 5-8: battery cell count
sbufWriteU8(dst, batteryWasFullWhenPluggedIn() | (batteryUsesCapacityThresholds() << 1) | (getBatteryState() << 2) | (getBatteryCellCount() << 4));
Expand Down
1 change: 0 additions & 1 deletion src/main/msp/msp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@
#define MSP_COMP_GPS 107 //out message distance home, direction home
#define MSP_ATTITUDE 108 //out message 2 angles 1 heading
#define MSP_ALTITUDE 109 //out message altitude, variometer
#define MSP_ANALOG 110 //DEPRECATED in INAV 9.1 - use MSP2_INAV_ANALOG instead. Will be removed in INAV 10.0
#define MSP_RC_TUNING 111 //out message rc rate, rc expo, rollpitch rate, yaw rate, dyn throttle PID
#define MSP_ACTIVEBOXES 113 //out message Active box flags (full width, more than 32 bits)
#define MSP_MISC 114 //DEPRECATED in INAV 9.1 - use MSP2_INAV_MISC instead. Will be removed in INAV 10.0
Expand Down
10 changes: 6 additions & 4 deletions src/main/target/SITL/serial_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "drivers/time.h"
#include "msp/msp_serial.h"
#include "msp/msp_protocol.h"
#include "msp/msp_protocol_v2_inav.h"
#include "common/crc.h"
#include "rx/sim.h"

Expand Down Expand Up @@ -524,7 +525,7 @@ static void mspRequestChannels(void)

static void mspRequestRssi(void)
{
mspSendCommand(MSP_ANALOG, NULL, 0);
mspSendCommand(MSP2_INAV_ANALOG, NULL, 0);
}

static void requestRXConfigState(void)
Expand All @@ -549,10 +550,11 @@ static void processMessage(void)
rxSimSetChannelValue(channels, count);
}
}
} else if ( code == MSP_ANALOG ) {
} else if ( code == MSP2_INAV_ANALOG ) {
if ( reqCount > 0 ) reqCount--;
if ( message_length_received >= 7 ) {
rssi = *((uint16_t *)(&message_buffer[3]));
// RSSI is the last field of the MSP2_INAV_ANALOG reply payload (byte 22)
if ( message_length_received >= 24 ) {
rssi = *((uint16_t *)(&message_buffer[22]));
rxSimSetRssi( rssi );
}
} else if ( code == MSP_RX_CONFIG ) {
Expand Down
Loading