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
43 changes: 43 additions & 0 deletions docs/development/msp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,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 @@ -4878,6 +4881,46 @@ 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:** Reads the unaligned magnetometer vector.

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

**Reply Payload:**
|Field|C Type|Size (Bytes)|Description|
|---|---|---|---|
| `magADCUnaligned` | `int16_t[3]` | 6 | X, Y and Z components, rounded to signed 16-bit values. |

**Notes:** Returns rounded mag.magADCUnaligned values before board alignment. Returns three zeroes without USE_MAG.

## <a id="msp2_inav_esc_srxl2_status"></a>`MSP2_INAV_ESC_SRXL2_STATUS (8755 / 0x2233)`
**Description:** Reads SRXL2 ESC calibration and connection status.

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

**Reply Payload:**
|Field|C Type|Size (Bytes)|Description|
|---|---|---|---|
| `phase` | `uint8_t` | 1 | Calibration phase (srxl2CalPhase_e). |
| `connected` | `uint8_t` | 1 | 1 when every opened ESC is connected; otherwise 0. |
| `lastResult` | `uint8_t` | 1 | Last calibration start result (srxl2CalResult_e). |
| `portCount` | `uint8_t` | 1 | Number of opened SRXL2 motor ports. |
| `motorCount` | `uint8_t` | 1 | Number of motors in the current mixer. |

**Notes:** Requires USE_MOTOR_SRXL2. Counts report opened motor ports and the current mixer motor count, not hardware capacity.

## <a id="msp2_inav_esc_srxl2_calibrate"></a>`MSP2_INAV_ESC_SRXL2_CALIBRATE (8756 / 0x2234)`
**Description:** Controls SRXL2 ESC throttle-range calibration.

**Request Payload:**
|Field|C Type|Size (Bytes)|Description|
|---|---|---|---|
| `phase` | `uint8_t` | 1 | Requested calibration action (srxl2CalPhase_e): 0, 1, 4 or 5. |

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

**Notes:** Requires USE_MOTOR_SRXL2 and at least one request byte. Accepted commands: 0 abort, 1 automatic start, 4 manual high, 5 manual low. Driver safety checks can reject start requests; read MSP2_INAV_ESC_SRXL2_STATUS for the reason. Other command values return an MSP error. Remove propellers before calibration.

## <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
85 changes: 43 additions & 42 deletions docs/development/msp/inav_enums.json
Original file line number Diff line number Diff line change
Expand Up @@ -833,48 +833,49 @@
"DEVHW_LPS25H": "17",
"DEVHW_SPL06": "18",
"DEVHW_BMP388": "19",
"DEVHW_DPS310": "20",
"DEVHW_B2SMPB": "21",
"DEVHW_HMC5883": "22",
"DEVHW_AK8963": "23",
"DEVHW_AK8975": "24",
"DEVHW_IST8310_0": "25",
"DEVHW_IST8310_1": "26",
"DEVHW_IST8308": "27",
"DEVHW_QMC5883": "28",
"DEVHW_QMC5883P": "29",
"DEVHW_MAG3110": "30",
"DEVHW_LIS3MDL": "31",
"DEVHW_RM3100": "32",
"DEVHW_VCM5883": "33",
"DEVHW_MLX90393": "34",
"DEVHW_LIS2MDL": "35",
"DEVHW_LM75_0": "36",
"DEVHW_LM75_1": "37",
"DEVHW_LM75_2": "38",
"DEVHW_LM75_3": "39",
"DEVHW_LM75_4": "40",
"DEVHW_LM75_5": "41",
"DEVHW_LM75_6": "42",
"DEVHW_LM75_7": "43",
"DEVHW_DS2482": "44",
"DEVHW_MAX7456": "45",
"DEVHW_SRF10": "46",
"DEVHW_VL53L0X": "47",
"DEVHW_VL53L1X": "48",
"DEVHW_US42": "49",
"DEVHW_TOF10120_I2C": "50",
"DEVHW_TERARANGER_EVO_I2C": "51",
"DEVHW_MS4525": "52",
"DEVHW_MS5525": "53",
"DEVHW_DLVR": "54",
"DEVHW_M25P16": "55",
"DEVHW_W25N": "56",
"DEVHW_UG2864": "57",
"DEVHW_SDCARD": "58",
"DEVHW_IRLOCK": "59",
"DEVHW_PCF8574": "60",
"DEVHW_INA226": "61"
"DEVHW_DPS310_0": "20",
"DEVHW_DPS310_1": "21",
"DEVHW_B2SMPB": "22",
"DEVHW_HMC5883": "23",
"DEVHW_AK8963": "24",
"DEVHW_AK8975": "25",
"DEVHW_IST8310_0": "26",
"DEVHW_IST8310_1": "27",
"DEVHW_IST8308": "28",
"DEVHW_QMC5883": "29",
"DEVHW_QMC5883P": "30",
"DEVHW_MAG3110": "31",
"DEVHW_LIS3MDL": "32",
"DEVHW_RM3100": "33",
"DEVHW_VCM5883": "34",
"DEVHW_MLX90393": "35",
"DEVHW_LIS2MDL": "36",
"DEVHW_LM75_0": "37",
"DEVHW_LM75_1": "38",
"DEVHW_LM75_2": "39",
"DEVHW_LM75_3": "40",
"DEVHW_LM75_4": "41",
"DEVHW_LM75_5": "42",
"DEVHW_LM75_6": "43",
"DEVHW_LM75_7": "44",
"DEVHW_DS2482": "45",
"DEVHW_MAX7456": "46",
"DEVHW_SRF10": "47",
"DEVHW_VL53L0X": "48",
"DEVHW_VL53L1X": "49",
"DEVHW_US42": "50",
"DEVHW_TOF10120_I2C": "51",
"DEVHW_TERARANGER_EVO_I2C": "52",
"DEVHW_MS4525": "53",
"DEVHW_MS5525": "54",
"DEVHW_DLVR": "55",
"DEVHW_M25P16": "56",
"DEVHW_W25N": "57",
"DEVHW_UG2864": "58",
"DEVHW_SDCARD": "59",
"DEVHW_IRLOCK": "60",
"DEVHW_PCF8574": "61",
"DEVHW_INA226": "62"
},
"deviceFlags_e": {
"_source": "inav/src/main/drivers/bus.h",
Expand Down
85 changes: 43 additions & 42 deletions docs/development/msp/inav_enums_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -1460,48 +1460,49 @@
| `DEVHW_LPS25H` | 17 | |
| `DEVHW_SPL06` | 18 | |
| `DEVHW_BMP388` | 19 | |
| `DEVHW_DPS310` | 20 | |
| `DEVHW_B2SMPB` | 21 | |
| `DEVHW_HMC5883` | 22 | |
| `DEVHW_AK8963` | 23 | |
| `DEVHW_AK8975` | 24 | |
| `DEVHW_IST8310_0` | 25 | |
| `DEVHW_IST8310_1` | 26 | |
| `DEVHW_IST8308` | 27 | |
| `DEVHW_QMC5883` | 28 | |
| `DEVHW_QMC5883P` | 29 | |
| `DEVHW_MAG3110` | 30 | |
| `DEVHW_LIS3MDL` | 31 | |
| `DEVHW_RM3100` | 32 | |
| `DEVHW_VCM5883` | 33 | |
| `DEVHW_MLX90393` | 34 | |
| `DEVHW_LIS2MDL` | 35 | |
| `DEVHW_LM75_0` | 36 | |
| `DEVHW_LM75_1` | 37 | |
| `DEVHW_LM75_2` | 38 | |
| `DEVHW_LM75_3` | 39 | |
| `DEVHW_LM75_4` | 40 | |
| `DEVHW_LM75_5` | 41 | |
| `DEVHW_LM75_6` | 42 | |
| `DEVHW_LM75_7` | 43 | |
| `DEVHW_DS2482` | 44 | |
| `DEVHW_MAX7456` | 45 | |
| `DEVHW_SRF10` | 46 | |
| `DEVHW_VL53L0X` | 47 | |
| `DEVHW_VL53L1X` | 48 | |
| `DEVHW_US42` | 49 | |
| `DEVHW_TOF10120_I2C` | 50 | |
| `DEVHW_TERARANGER_EVO_I2C` | 51 | |
| `DEVHW_MS4525` | 52 | |
| `DEVHW_MS5525` | 53 | |
| `DEVHW_DLVR` | 54 | |
| `DEVHW_M25P16` | 55 | |
| `DEVHW_W25N` | 56 | |
| `DEVHW_UG2864` | 57 | |
| `DEVHW_SDCARD` | 58 | |
| `DEVHW_IRLOCK` | 59 | |
| `DEVHW_PCF8574` | 60 | |
| `DEVHW_INA226` | 61 | |
| `DEVHW_DPS310_0` | 20 | |
| `DEVHW_DPS310_1` | 21 | |
| `DEVHW_B2SMPB` | 22 | |
| `DEVHW_HMC5883` | 23 | |
| `DEVHW_AK8963` | 24 | |
| `DEVHW_AK8975` | 25 | |
| `DEVHW_IST8310_0` | 26 | |
| `DEVHW_IST8310_1` | 27 | |
| `DEVHW_IST8308` | 28 | |
| `DEVHW_QMC5883` | 29 | |
| `DEVHW_QMC5883P` | 30 | |
| `DEVHW_MAG3110` | 31 | |
| `DEVHW_LIS3MDL` | 32 | |
| `DEVHW_RM3100` | 33 | |
| `DEVHW_VCM5883` | 34 | |
| `DEVHW_MLX90393` | 35 | |
| `DEVHW_LIS2MDL` | 36 | |
| `DEVHW_LM75_0` | 37 | |
| `DEVHW_LM75_1` | 38 | |
| `DEVHW_LM75_2` | 39 | |
| `DEVHW_LM75_3` | 40 | |
| `DEVHW_LM75_4` | 41 | |
| `DEVHW_LM75_5` | 42 | |
| `DEVHW_LM75_6` | 43 | |
| `DEVHW_LM75_7` | 44 | |
| `DEVHW_DS2482` | 45 | |
| `DEVHW_MAX7456` | 46 | |
| `DEVHW_SRF10` | 47 | |
| `DEVHW_VL53L0X` | 48 | |
| `DEVHW_VL53L1X` | 49 | |
| `DEVHW_US42` | 50 | |
| `DEVHW_TOF10120_I2C` | 51 | |
| `DEVHW_TERARANGER_EVO_I2C` | 52 | |
| `DEVHW_MS4525` | 53 | |
| `DEVHW_MS5525` | 54 | |
| `DEVHW_DLVR` | 55 | |
| `DEVHW_M25P16` | 56 | |
| `DEVHW_W25N` | 57 | |
| `DEVHW_UG2864` | 58 | |
| `DEVHW_SDCARD` | 59 | |
| `DEVHW_IRLOCK` | 60 | |
| `DEVHW_PCF8574` | 61 | |
| `DEVHW_INA226` | 62 | |

---
## <a id="enum-deviceflags_e"></a>`deviceFlags_e`
Expand Down
77 changes: 77 additions & 0 deletions docs/development/msp/msp_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -11674,6 +11674,83 @@
},
"notes": "Requires a receiver using MSP as the protocol, sends MSP2_RX_BIND to the receiver.",
"description": "Initiates binding for MSP receivers (mLRS)."
},
"MSP2_INAV_MAG_UNALIGNED": {
"code": 8754,
"mspv": 2,
"request": null,
"reply": {
"payload": [
{
"name": "magADCUnaligned",
"ctype": "int16_t",
"desc": "X, Y and Z components, rounded to signed 16-bit values.",
"units": "",
"array": true,
"array_size": 3
}
]
},
"notes": "Returns rounded mag.magADCUnaligned values before board alignment. Returns three zeroes without USE_MAG.",
"description": "Reads the unaligned magnetometer vector."
},
"MSP2_INAV_ESC_SRXL2_STATUS": {
"code": 8755,
"mspv": 2,
"request": null,
"reply": {
"payload": [
{
"name": "phase",
"ctype": "uint8_t",
"desc": "Calibration phase (srxl2CalPhase_e).",
"units": ""
},
{
"name": "connected",
"ctype": "uint8_t",
"desc": "1 when every opened ESC is connected; otherwise 0.",
"units": ""
},
{
"name": "lastResult",
"ctype": "uint8_t",
"desc": "Last calibration start result (srxl2CalResult_e).",
"units": ""
},
{
"name": "portCount",
"ctype": "uint8_t",
"desc": "Number of opened SRXL2 motor ports.",
"units": ""
},
{
"name": "motorCount",
"ctype": "uint8_t",
"desc": "Number of motors in the current mixer.",
"units": ""
}
]
},
"notes": "Requires USE_MOTOR_SRXL2. Counts report opened motor ports and the current mixer motor count, not hardware capacity.",
"description": "Reads SRXL2 ESC calibration and connection status."
},
"MSP2_INAV_ESC_SRXL2_CALIBRATE": {
"code": 8756,
"mspv": 2,
"request": {
"payload": [
{
"name": "phase",
"ctype": "uint8_t",
"desc": "Requested calibration action (srxl2CalPhase_e): 0, 1, 4 or 5.",
"units": ""
}
]
},
"reply": null,
"notes": "Requires USE_MOTOR_SRXL2 and at least one request byte. Accepted commands: 0 abort, 1 automatic start, 4 manual high, 5 manual low. Driver safety checks can reject start requests; read MSP2_INAV_ESC_SRXL2_STATUS for the reason. Other command values return an MSP error. Remove propellers before calibration.",
"description": "Controls SRXL2 ESC throttle-range calibration."
}
}
}
23 changes: 14 additions & 9 deletions src/main/drivers/barometer/barometer_dps310.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,23 @@ static bool deviceDetect(busDevice_t * busDev)

bool baroDPS310Detect(baroDev_t *baro)
{
baro->busDev = busDeviceInit(BUSTYPE_ANY, DEVHW_DPS310, 0, OWNER_BARO);
if (baro->busDev == NULL) {
return false;
}
// The sensor may sit on either of its two I2C addresses, depending on how SDO is wired
bool detected = false;

if (!deviceDetect(baro->busDev)) {
busDeviceDeInit(baro->busDev);
return false;
for (uint8_t index = 0; index < 2 && !detected; index++) {
baro->busDev = busDeviceInit(BUSTYPE_ANY, DEVHW_DPS310_0 + index, 0, OWNER_BARO);
if (baro->busDev == NULL) {
continue;
}

if (deviceDetect(baro->busDev) && deviceConfigure(baro->busDev)) {
detected = true;
} else {
busDeviceDeInit(baro->busDev);
}
}

if (!deviceConfigure(baro->busDev)) {
busDeviceDeInit(baro->busDev);
if (!detected) {
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/drivers/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ typedef enum {
DEVHW_LPS25H,
DEVHW_SPL06,
DEVHW_BMP388,
DEVHW_DPS310,
DEVHW_DPS310_0,
DEVHW_DPS310_1,
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
DEVHW_B2SMPB,

/* Compass chips */
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/HUMMINGBIRD_FC305/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688, DEVHW_ICM42605, ICM42605_SPI_BUS, ICM42605_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42605_ALIGN);
BUSDEV_REGISTER_SPI(busdev_sdcard_spi, DEVHW_SDCARD, SDCARD_SPI_BUS, SDCARD_CS_PIN, NONE, DEVFLAGS_SPI_MODE_0, 0);
BUSDEV_REGISTER_SPI(busdev_max7456, DEVHW_MAX7456, MAX7456_SPI_BUS, MAX7456_CS_PIN, NONE, DEVFLAGS_USE_RAW_REGISTERS, 0);
BUSDEV_REGISTER_I2C(busdev_dps310, DEVHW_DPS310, BARO_I2C_BUS, DPS310_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);
BUSDEV_REGISTER_I2C(busdev_dps310_0, DEVHW_DPS310_0, BARO_I2C_BUS, DPS310_I2C_ADDR, NONE, DEVFLAGS_NONE, 0);

BUSDEV_REGISTER_I2C(busdev_qmc5883, DEVHW_QMC5883, MAG_I2C_BUS, 0x0D, NONE, DEVFLAGS_NONE, 0);
BUSDEV_REGISTER_I2C(busdev_hmc5883, DEVHW_HMC5883, MAG_I2C_BUS, 0x1E, NONE, DEVFLAGS_NONE, 0);
Expand Down
Loading
Loading