diff --git a/docs/development/msp/README.md b/docs/development/msp/README.md index 7377eef84bc..d94e2938b29 100644 --- a/docs/development/msp/README.md +++ b/docs/development/msp/README.md @@ -280,7 +280,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: [110 - MSP_ANALOG](#msp_analog) [111 - MSP_RC_TUNING](#msp_rc_tuning) [113 - MSP_ACTIVEBOXES](#msp_activeboxes) -[114 - MSP_MISC](#msp_misc) [116 - MSP_BOXNAMES](#msp_boxnames) [117 - MSP_PIDNAMES](#msp_pidnames) [118 - MSP_WP](#msp_wp) @@ -311,7 +310,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: [204 - MSP_SET_RC_TUNING](#msp_set_rc_tuning) [205 - MSP_ACC_CALIBRATION](#msp_acc_calibration) [206 - MSP_MAG_CALIBRATION](#msp_mag_calibration) -[207 - MSP_SET_MISC](#msp_set_misc) [208 - MSP_RESET_CONF](#msp_reset_conf) [209 - MSP_SET_WP](#msp_set_wp) [210 - MSP_SELECT_SETTING](#msp_select_setting) @@ -2008,33 +2006,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: **Notes:** Use this instead of `MSP_STATUS` or `MSP_STATUS_EX` if more than 32 modes are possible. -## `MSP_MISC (114 / 0x72)` -**Description:** Retrieves miscellaneous configuration settings, mostly related to RC, GPS, Mag, and Battery voltage (legacy formats). - -**Request Payload:** **None** - -**Reply Payload:** -|Field|C Type|Size (Bytes)|Units|Description| -|---|---|---|---|---| -| `midRc` | `uint16_t` | 2 | PWM | Mid RC value (`PWM_RANGE_MIDDLE`, typically 1500) | -| `legacyMinThrottle` | `uint16_t` | 2 | - | Always 0 (Legacy) | -| `maxThrottle` | `uint16_t` | 2 | PWM | Maximum throttle command (`getMaxThrottle()`) | -| `minCommand` | `uint16_t` | 2 | PWM | Minimum motor command when disarmed (`motorConfig()->mincommand`) | -| `failsafeThrottle` | `uint16_t` | 2 | PWM | Failsafe throttle level (`currentBatteryProfile->failsafe_throttle`) | -| `gpsType` | `uint8_t` | 1 | [gpsProvider_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-gpsprovider_e) | Enum `gpsProvider_e` GPS provider type (`gpsConfig()->provider`). 0 if `USE_GPS` disabled | -| `legacyGpsBaud` | `uint8_t` | 1 | - | Always 0 (Legacy) | -| `gpsSbasMode` | `uint8_t` | 1 | [sbasMode_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-sbasmode_e) | Enum `sbasMode_e` GPS SBAS mode (`gpsConfig()->sbasMode`). 0 if `USE_GPS` disabled | -| `legacyMwCurrentOut` | `uint8_t` | 1 | - | Always 0 (Legacy) | -| `rssiChannel` | `uint8_t` | 1 | Index | RSSI channel index (1-based) (`rxConfig()->rssi_channel`) | -| `reserved1` | `uint8_t` | 1 | - | Always 0 | -| `magDeclination` | `uint16_t` | 2 | 0.1 degrees | Magnetic declination / 10 (`compassConfig()->mag_declination / 10`). 0 if `USE_MAG` disabled | -| `vbatScale` | `uint8_t` | 1 | Scale / 10 | Voltage scale / 10 (`batteryMetersConfig()->voltage.scale / 10`). 0 if `USE_ADC` disabled | -| `vbatMinCell` | `uint8_t` | 1 | 0.1V | Min cell voltage / 10 (`currentBatteryProfile->voltage.cellMin / 10`). 0 if `USE_ADC` disabled | -| `vbatMaxCell` | `uint8_t` | 1 | 0.1V | Max cell voltage / 10 (`currentBatteryProfile->voltage.cellMax / 10`). 0 if `USE_ADC` disabled | -| `vbatWarningCell` | `uint8_t` | 1 | 0.1V | Warning cell voltage / 10 (`currentBatteryProfile->voltage.cellWarning / 10`). 0 if `USE_ADC` disabled | - -**Notes:** Superseded by `MSP2_INAV_MISC` and other specific commands which offer better precision and more fields. - ## `MSP_BOXNAMES (116 / 0x74)` **Description:** Provides a semicolon-separated string containing the names of all available flight modes (boxes). @@ -2443,33 +2414,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: **Notes:** Will fail if armed. Enables the `CALIBRATE_MAG` state flag. -## `MSP_SET_MISC (207 / 0xcf)` -**Description:** Sets miscellaneous configuration settings (legacy formats/scaling). - -**Request Payload:** -|Field|C Type|Size (Bytes)|Units|Description| -|---|---|---|---|---| -| `midRc` | `uint16_t` | 2 | PWM | Ignored | -| `legacyMinThrottle` | `uint16_t` | 2 | - | Ignored | -| `legacyMaxThrottle` | `uint16_t` | 2 | - | Ignored | -| `minCommand` | `uint16_t` | 2 | PWM | Sets `motorConfigMutable()->mincommand` (constrained 0-PWM_RANGE_MAX) | -| `failsafeThrottle` | `uint16_t` | 2 | PWM | Sets `currentBatteryProfileMutable->failsafe_throttle` (constrained PWM_RANGE_MIN/MAX) | -| `gpsType` | `uint8_t` | 1 | [gpsProvider_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-gpsprovider_e) | Enum `gpsProvider_e` (Sets `gpsConfigMutable()->provider`) | -| `legacyGpsBaud` | `uint8_t` | 1 | - | Ignored | -| `gpsSbasMode` | `uint8_t` | 1 | [sbasMode_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-sbasmode_e) | Enum `sbasMode_e` (Sets `gpsConfigMutable()->sbasMode`) | -| `legacyMwCurrentOut` | `uint8_t` | 1 | - | Ignored | -| `rssiChannel` | `uint8_t` | 1 | Index | Sets `rxConfigMutable()->rssi_channel` (constrained 0-MAX_SUPPORTED_RC_CHANNEL_COUNT). Updates source | -| `reserved1` | `uint8_t` | 1 | - | Ignored | -| `magDeclination` | `uint16_t` | 2 | 0.1 degrees | Sets `compassConfigMutable()->mag_declination = value * 10` (if `USE_MAG`) | -| `vbatScale` | `uint8_t` | 1 | Scale / 10 | Sets `batteryMetersConfigMutable()->voltage.scale = value * 10` (if `USE_ADC`) | -| `vbatMinCell` | `uint8_t` | 1 | 0.1V | Sets `currentBatteryProfileMutable->voltage.cellMin = value * 10` (if `USE_ADC`) | -| `vbatMaxCell` | `uint8_t` | 1 | 0.1V | Sets `currentBatteryProfileMutable->voltage.cellMax = value * 10` (if `USE_ADC`) | -| `vbatWarningCell` | `uint8_t` | 1 | 0.1V | Sets `currentBatteryProfileMutable->voltage.cellWarning = value * 10` (if `USE_ADC`) | - -**Reply Payload:** **None** - -**Notes:** Expects 22 bytes. Superseded by `MSP2_INAV_SET_MISC`. - ## `MSP_RESET_CONF (208 / 0xd0)` **Description:** Resets all configuration settings to their default values and saves to EEPROM. @@ -3192,7 +3136,7 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: **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). ## `MSP2_INAV_MISC (8195 / 0x2003)` -**Description:** Retrieves miscellaneous configuration settings, superseding `MSP_MISC` with higher precision and capacity fields. +**Description:** Retrieves miscellaneous configuration settings with higher precision and capacity fields. **Request Payload:** **None** @@ -3222,7 +3166,7 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: | `capacityUnit` | `uint8_t` | 1 | [batCapacityUnit_e](https://github.com/iNavFlight/inav/wiki/Enums-reference#enum-batcapacityunit_e) | Enum `batCapacityUnit_e` Capacity unit (`batteryMetersConfig()->capacity_unit`) | ## `MSP2_INAV_SET_MISC (8196 / 0x2004)` -**Description:** Sets miscellaneous configuration settings, superseding `MSP_SET_MISC`. +**Description:** Sets miscellaneous configuration settings. **Request Payload:** |Field|C Type|Size (Bytes)|Units|Description| diff --git a/docs/development/msp/msp_messages.json b/docs/development/msp/msp_messages.json index 176833915ad..09fcc165bac 100644 --- a/docs/development/msp/msp_messages.json +++ b/docs/development/msp/msp_messages.json @@ -1,7 +1,7 @@ { "version": { - "major": 2, - "minor": 1, + "major": 3, + "minor": 0, "patch": 0 }, "messages": { @@ -4054,116 +4054,6 @@ "notes": "Use this instead of `MSP_STATUS` or `MSP_STATUS_EX` if more than 32 modes are possible.", "description": "Provides the full bitmask of currently active flight modes (boxes)." }, - "MSP_MISC": { - "code": 114, - "mspv": 1, - "replaced_by": ["MSP2_INAV_MISC"], - "request": null, - "reply": { - "payload": [ - { - "name": "midRc", - "ctype": "uint16_t", - "desc": "Mid RC value (`PWM_RANGE_MIDDLE`, typically 1500)", - "units": "PWM" - }, - { - "name": "legacyMinThrottle", - "ctype": "uint16_t", - "desc": "Always 0 (Legacy)", - "value": 0 - }, - { - "name": "maxThrottle", - "ctype": "uint16_t", - "desc": "Maximum throttle command (`getMaxThrottle()`)", - "units": "PWM" - }, - { - "name": "minCommand", - "ctype": "uint16_t", - "desc": "Minimum motor command when disarmed (`motorConfig()->mincommand`)", - "units": "PWM" - }, - { - "name": "failsafeThrottle", - "ctype": "uint16_t", - "desc": "Failsafe throttle level (`currentBatteryProfile->failsafe_throttle`)", - "units": "PWM" - }, - { - "name": "gpsType", - "ctype": "uint8_t", - "desc": "Enum `gpsProvider_e` GPS provider type (`gpsConfig()->provider`). 0 if `USE_GPS` disabled", - "units": "Enum", - "enum": "gpsProvider_e" - }, - { - "name": "legacyGpsBaud", - "ctype": "uint8_t", - "desc": "Always 0 (Legacy)", - "value": 0 - }, - { - "name": "gpsSbasMode", - "ctype": "uint8_t", - "desc": "Enum `sbasMode_e` GPS SBAS mode (`gpsConfig()->sbasMode`). 0 if `USE_GPS` disabled", - "units": "Enum", - "enum": "sbasMode_e" - }, - { - "name": "legacyMwCurrentOut", - "ctype": "uint8_t", - "desc": "Always 0 (Legacy)", - "value": 0 - }, - { - "name": "rssiChannel", - "ctype": "uint8_t", - "desc": "RSSI channel index (1-based) (`rxConfig()->rssi_channel`)", - "units": "Index" - }, - { - "name": "reserved1", - "ctype": "uint8_t", - "desc": "Always 0", - "value": 0 - }, - { - "name": "magDeclination", - "ctype": "uint16_t", - "desc": "Magnetic declination / 10 (`compassConfig()->mag_declination / 10`). 0 if `USE_MAG` disabled", - "units": "0.1 degrees" - }, - { - "name": "vbatScale", - "ctype": "uint8_t", - "desc": "Voltage scale / 10 (`batteryMetersConfig()->voltage.scale / 10`). 0 if `USE_ADC` disabled", - "units": "Scale / 10" - }, - { - "name": "vbatMinCell", - "ctype": "uint8_t", - "desc": "Min cell voltage / 10 (`currentBatteryProfile->voltage.cellMin / 10`). 0 if `USE_ADC` disabled", - "units": "0.1V" - }, - { - "name": "vbatMaxCell", - "ctype": "uint8_t", - "desc": "Max cell voltage / 10 (`currentBatteryProfile->voltage.cellMax / 10`). 0 if `USE_ADC` disabled", - "units": "0.1V" - }, - { - "name": "vbatWarningCell", - "ctype": "uint8_t", - "desc": "Warning cell voltage / 10 (`currentBatteryProfile->voltage.cellWarning / 10`). 0 if `USE_ADC` disabled", - "units": "0.1V" - } - ] - }, - "notes": "Superseded by `MSP2_INAV_MISC` and other specific commands which offer better precision and more fields.", - "description": "Retrieves miscellaneous configuration settings, mostly related to RC, GPS, Mag, and Battery voltage (legacy formats)." - }, "MSP_BOXNAMES": { "code": 116, "mspv": 1, @@ -5159,111 +5049,6 @@ "notes": "Will fail if armed. Enables the `CALIBRATE_MAG` state flag.", "description": "Starts the magnetometer calibration procedure." }, - "MSP_SET_MISC": { - "code": 207, - "mspv": 1, - "replaced_by": ["MSP2_INAV_SET_MISC"], - "request": { - "payload": [ - { - "name": "midRc", - "ctype": "uint16_t", - "desc": "Ignored", - "units": "PWM" - }, - { - "name": "legacyMinThrottle", - "ctype": "uint16_t", - "desc": "Ignored" - }, - { - "name": "legacyMaxThrottle", - "ctype": "uint16_t", - "desc": "Ignored" - }, - { - "name": "minCommand", - "ctype": "uint16_t", - "desc": "Sets `motorConfigMutable()->mincommand` (constrained 0-PWM_RANGE_MAX)", - "units": "PWM" - }, - { - "name": "failsafeThrottle", - "ctype": "uint16_t", - "desc": "Sets `currentBatteryProfileMutable->failsafe_throttle` (constrained PWM_RANGE_MIN/MAX)", - "units": "PWM" - }, - { - "name": "gpsType", - "ctype": "uint8_t", - "desc": "Enum `gpsProvider_e` (Sets `gpsConfigMutable()->provider`)", - "units": "Enum", - "enum": "gpsProvider_e" - }, - { - "name": "legacyGpsBaud", - "ctype": "uint8_t", - "desc": "Ignored" - }, - { - "name": "gpsSbasMode", - "ctype": "uint8_t", - "desc": "Enum `sbasMode_e` (Sets `gpsConfigMutable()->sbasMode`)", - "units": "Enum", - "enum": "sbasMode_e" - }, - { - "name": "legacyMwCurrentOut", - "ctype": "uint8_t", - "desc": "Ignored" - }, - { - "name": "rssiChannel", - "ctype": "uint8_t", - "desc": "Sets `rxConfigMutable()->rssi_channel` (constrained 0-MAX_SUPPORTED_RC_CHANNEL_COUNT). Updates source", - "units": "Index" - }, - { - "name": "reserved1", - "ctype": "uint8_t", - "desc": "Ignored" - }, - { - "name": "magDeclination", - "ctype": "uint16_t", - "desc": "Sets `compassConfigMutable()->mag_declination = value * 10` (if `USE_MAG`)", - "units": "0.1 degrees" - }, - { - "name": "vbatScale", - "ctype": "uint8_t", - "desc": "Sets `batteryMetersConfigMutable()->voltage.scale = value * 10` (if `USE_ADC`)", - "units": "Scale / 10" - }, - { - "name": "vbatMinCell", - "ctype": "uint8_t", - "desc": "Sets `currentBatteryProfileMutable->voltage.cellMin = value * 10` (if `USE_ADC`)", - "units": "0.1V" - }, - { - "name": "vbatMaxCell", - "ctype": "uint8_t", - "desc": "Sets `currentBatteryProfileMutable->voltage.cellMax = value * 10` (if `USE_ADC`)", - "units": "0.1V" - }, - { - "name": "vbatWarningCell", - "ctype": "uint8_t", - "desc": "Sets `currentBatteryProfileMutable->voltage.cellWarning = value * 10` (if `USE_ADC`)", - "units": "0.1V" - } - ] - }, - "reply": null, - "notes": "Expects 22 bytes. Superseded by `MSP2_INAV_SET_MISC`.", - "description": "Sets miscellaneous configuration settings (legacy formats/scaling)." - }, "MSP_RESET_CONF": { "code": 208, "mspv": 1, @@ -7098,7 +6883,7 @@ ] }, "notes": "", - "description": "Retrieves miscellaneous configuration settings, superseding `MSP_MISC` with higher precision and capacity fields." + "description": "Retrieves miscellaneous configuration settings with higher precision and capacity fields." }, "MSP2_INAV_SET_MISC": { "code": 8196, @@ -7236,7 +7021,7 @@ }, "reply": null, "notes": "Expects 41 bytes. Performs validation on `vbatSource` and `capacityUnit`.", - "description": "Sets miscellaneous configuration settings, superseding `MSP_SET_MISC`." + "description": "Sets miscellaneous configuration settings." }, "MSP2_INAV_BATTERY_CONFIG": { "code": 8197, diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 1edf45749e2..e4a07d12659 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -883,47 +883,6 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF serializeBoxReply(dst); break; - case MSP_MISC: - sbufWriteU16(dst, PWM_RANGE_MIDDLE); - - sbufWriteU16(dst, 0); // Was min_throttle - sbufWriteU16(dst, getMaxThrottle()); - sbufWriteU16(dst, motorConfig()->mincommand); - - sbufWriteU16(dst, currentBatteryProfile->failsafe_throttle); - -#ifdef USE_GPS - sbufWriteU8(dst, gpsConfig()->provider); // gps_type - sbufWriteU8(dst, 0); // TODO gps_baudrate (an index, cleanflight uses a uint32_t - sbufWriteU8(dst, gpsConfig()->sbasMode); // gps_ubx_sbas -#else - sbufWriteU8(dst, 0); // gps_type - sbufWriteU8(dst, 0); // TODO gps_baudrate (an index, cleanflight uses a uint32_t - sbufWriteU8(dst, 0); // gps_ubx_sbas -#endif - sbufWriteU8(dst, 0); // multiwiiCurrentMeterOutput - sbufWriteU8(dst, rxConfig()->rssi_channel); - sbufWriteU8(dst, 0); - -#ifdef USE_MAG - sbufWriteU16(dst, compassConfig()->mag_declination / 10); -#else - sbufWriteU16(dst, 0); -#endif - -#ifdef USE_ADC - sbufWriteU8(dst, batteryMetersConfig()->voltage.scale / 10); - sbufWriteU8(dst, currentBatteryProfile->voltage.cellMin / 10); - sbufWriteU8(dst, currentBatteryProfile->voltage.cellMax / 10); - sbufWriteU8(dst, currentBatteryProfile->voltage.cellWarning / 10); -#else - sbufWriteU8(dst, 0); - sbufWriteU8(dst, 0); - sbufWriteU8(dst, 0); - sbufWriteU8(dst, 0); -#endif - break; - case MSP2_INAV_MISC: sbufWriteU16(dst, PWM_RANGE_MIDDLE); @@ -2345,54 +2304,6 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) } break; - case MSP_SET_MISC: - if (dataSize == 22) { - sbufReadU16(src); // midrc - - sbufReadU16(src); //Was min_throttle - sbufReadU16(src); //Was maxThrottle - motorConfigMutable()->mincommand = constrain(sbufReadU16(src), 0, PWM_RANGE_MAX); - - currentBatteryProfileMutable->failsafe_throttle = constrain(sbufReadU16(src), PWM_RANGE_MIN, PWM_RANGE_MAX); - -#ifdef USE_GPS - gpsConfigMutable()->provider = sbufReadU8(src); // gps_type - sbufReadU8(src); // gps_baudrate - gpsConfigMutable()->sbasMode = sbufReadU8(src); // gps_ubx_sbas -#else - sbufReadU8(src); // gps_type - sbufReadU8(src); // gps_baudrate - sbufReadU8(src); // gps_ubx_sbas -#endif - sbufReadU8(src); // multiwiiCurrentMeterOutput - tmp_u8 = sbufReadU8(src); - if (tmp_u8 <= MAX_SUPPORTED_RC_CHANNEL_COUNT) { - rxConfigMutable()->rssi_channel = tmp_u8; - rxUpdateRSSISource(); // Changing rssi_channel might change the RSSI source - } - sbufReadU8(src); - -#ifdef USE_MAG - compassConfigMutable()->mag_declination = sbufReadU16(src) * 10; -#else - sbufReadU16(src); -#endif - -#ifdef USE_ADC - batteryMetersConfigMutable()->voltage.scale = sbufReadU8(src) * 10; - currentBatteryProfileMutable->voltage.cellMin = sbufReadU8(src) * 10; // vbatlevel_warn1 in MWC2.3 GUI - currentBatteryProfileMutable->voltage.cellMax = sbufReadU8(src) * 10; // vbatlevel_warn2 in MWC2.3 GUI - currentBatteryProfileMutable->voltage.cellWarning = sbufReadU8(src) * 10; // vbatlevel when buzzer starts to alert -#else - sbufReadU8(src); - sbufReadU8(src); - sbufReadU8(src); - sbufReadU8(src); -#endif - } else - return MSP_RESULT_ERROR; - break; - case MSP2_INAV_SET_MISC: if (dataSize == 41) { sbufReadU16(src); // midrc diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index 6b4705a738c..6d0ca71a2b6 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -243,7 +243,6 @@ #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 #define MSP_BOXNAMES 116 //out message the aux switch names #define MSP_PIDNAMES 117 //DEPRECATED in INAV 9.1 - no replacement needed (static data). Will be removed in INAV 10.0 #define MSP_WP 118 //out message get a WP, WP# is in the payload, returns (WP#, lat, lon, alt, flags) WP#0-home, WP#16-poshold @@ -263,7 +262,6 @@ #define MSP_SET_RC_TUNING 204 //in message rc rate, rc expo, rollpitch rate, yaw rate, dyn throttle PID, yaw expo #define MSP_ACC_CALIBRATION 205 //in message no param #define MSP_MAG_CALIBRATION 206 //in message no param -#define MSP_SET_MISC 207 //DEPRECATED in INAV 9.1 - use MSP2_INAV_SET_MISC instead. Will be removed in INAV 10.0 #define MSP_RESET_CONF 208 //in message no param #define MSP_SET_WP 209 //in message sets a given WP (WP#,lat, lon, alt, flags) #define MSP_SELECT_SETTING 210 //in message Select Setting Number (0-2)