diff --git a/docs/development/msp/README.md b/docs/development/msp/README.md index 7377eef84bc..c7b623f7d0f 100644 --- a/docs/development/msp/README.md +++ b/docs/development/msp/README.md @@ -259,8 +259,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: [89 - MSP_SET_VTX_CONFIG](#msp_set_vtx_config) [90 - MSP_ADVANCED_CONFIG](#msp_advanced_config) [91 - MSP_SET_ADVANCED_CONFIG](#msp_set_advanced_config) -[92 - MSP_FILTER_CONFIG](#msp_filter_config) -[93 - MSP_SET_FILTER_CONFIG](#msp_set_filter_config) [94 - MSP_PID_ADVANCED](#msp_pid_advanced) [95 - MSP_SET_PID_ADVANCED](#msp_set_pid_advanced) [96 - MSP_SENSOR_CONFIG](#msp_sensor_config) @@ -1680,50 +1678,6 @@ When the MSP JSON specification changes, bump `msp_messages.json` version: **Notes:** Expects 9 bytes. -## `MSP_FILTER_CONFIG (92 / 0x5c)` -**Description:** Retrieves filter configuration settings (Gyro, D-term, Yaw, Accel). Some fields are BF compatibility placeholders or legacy. - -**Request Payload:** **None** - -**Reply Payload:** -|Field|C Type|Size (Bytes)|Units|Description| -|---|---|---|---|---| -| `gyroMainLpfHz` | `uint8_t` | 1 | Hz | Gyro main low-pass filter cutoff frequency (`gyroConfig()->gyro_main_lpf_hz`) | -| `dtermLpfHz` | `uint16_t` | 2 | Hz | D-term low-pass filter cutoff frequency (`pidProfile()->dterm_lpf_hz`) | -| `yawLpfHz` | `uint16_t` | 2 | Hz | Yaw low-pass filter cutoff frequency (`pidProfile()->yaw_lpf_hz`) | -| `legacyGyroNotchHz` | `uint16_t` | 2 | - | Always 0 (Legacy) | -| `legacyGyroNotchCutoff` | `uint16_t` | 2 | - | Always 1 (Legacy) | -| `bfCompatDtermNotchHz` | `uint16_t` | 2 | - | Always 0 (BF compatibility) | -| `bfCompatDtermNotchCutoff` | `uint16_t` | 2 | - | Always 1 (BF compatibility) | -| `bfCompatGyroNotch2Hz` | `uint16_t` | 2 | - | Always 0 (BF compatibility) | -| `bfCompatGyroNotch2Cutoff` | `uint16_t` | 2 | - | Always 1 (BF compatibility) | -| `accNotchHz` | `uint16_t` | 2 | Hz | Accelerometer notch filter center frequency (`accelerometerConfig()->acc_notch_hz`) | -| `accNotchCutoff` | `uint16_t` | 2 | Hz | Accelerometer notch filter cutoff frequency (`accelerometerConfig()->acc_notch_cutoff`) | -| `legacyGyroStage2LpfHz` | `uint16_t` | 2 | - | Always 0 (Legacy) | - -## `MSP_SET_FILTER_CONFIG (93 / 0x5d)` -**Description:** Sets filter configuration settings. Handles different payload lengths for backward compatibility. - -**Request Payload:** -|Field|C Type|Size (Bytes)|Units|Description| -|---|---|---|---|---| -| `gyroMainLpfHz` | `uint8_t` | 1 | Hz | Sets `gyroConfigMutable()->gyro_main_lpf_hz`. (Size >= 5) | -| `dtermLpfHz` | `uint16_t` | 2 | Hz | Sets `pidProfileMutable()->dterm_lpf_hz` (constrained 0-500). (Size >= 5) | -| `yawLpfHz` | `uint16_t` | 2 | Hz | Sets `pidProfileMutable()->yaw_lpf_hz` (constrained 0-255). (Size >= 5) | -| `legacyGyroNotchHz` | `uint16_t` | 2 | - | Ignored. (Size >= 9) | -| `legacyGyroNotchCutoff` | `uint16_t` | 2 | - | Ignored. (Size >= 9) | -| `bfCompatDtermNotchHz` | `uint16_t` | 2 | - | Ignored. (Size >= 13) | -| `bfCompatDtermNotchCutoff` | `uint16_t` | 2 | - | Ignored. (Size >= 13) | -| `bfCompatGyroNotch2Hz` | `uint16_t` | 2 | - | Ignored. (Size >= 17) | -| `bfCompatGyroNotch2Cutoff` | `uint16_t` | 2 | - | Ignored. (Size >= 17) | -| `accNotchHz` | `uint16_t` | 2 | Hz | Sets `accelerometerConfigMutable()->acc_notch_hz` (constrained 0-255). (Size >= 21) | -| `accNotchCutoff` | `uint16_t` | 2 | Hz | Sets `accelerometerConfigMutable()->acc_notch_cutoff` (constrained 1-255). (Size >= 21) | -| `legacyGyroStage2LpfHz` | `uint16_t` | 2 | - | Ignored. (Size >= 22) | - -**Reply Payload:** **None** - -**Notes:** Requires at least 22 bytes; intermediate length checks enforce legacy Betaflight frame layout and call `pidInitFilters()` once the D-term notch placeholders are consumed. - ## `MSP_PID_ADVANCED (94 / 0x5e)` **Description:** Retrieves advanced PID tuning parameters. Many fields are BF compatibility placeholders. diff --git a/docs/development/msp/msp_messages.json b/docs/development/msp/msp_messages.json index 176833915ad..4fccd1fcc06 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": { @@ -3143,167 +3143,6 @@ "notes": "Expects 9 bytes.", "description": "Sets advanced hardware-related configuration (PWM protocols, rates)." }, - "MSP_FILTER_CONFIG": { - "code": 92, - "mspv": 1, - "replaced_by": ["MSP2_COMMON_SETTING"], - "request": null, - "reply": { - "payload": [ - { - "name": "gyroMainLpfHz", - "ctype": "uint8_t", - "desc": "Gyro main low-pass filter cutoff frequency (`gyroConfig()->gyro_main_lpf_hz`)", - "units": "Hz" - }, - { - "name": "dtermLpfHz", - "ctype": "uint16_t", - "desc": "D-term low-pass filter cutoff frequency (`pidProfile()->dterm_lpf_hz`)", - "units": "Hz" - }, - { - "name": "yawLpfHz", - "ctype": "uint16_t", - "desc": "Yaw low-pass filter cutoff frequency (`pidProfile()->yaw_lpf_hz`)", - "units": "Hz" - }, - { - "name": "legacyGyroNotchHz", - "ctype": "uint16_t", - "desc": "Always 0 (Legacy)", - "value": 0 - }, - { - "name": "legacyGyroNotchCutoff", - "ctype": "uint16_t", - "desc": "Always 1 (Legacy)", - "value": 1 - }, - { - "name": "bfCompatDtermNotchHz", - "ctype": "uint16_t", - "desc": "Always 0 (BF compatibility)", - "value": 0 - }, - { - "name": "bfCompatDtermNotchCutoff", - "ctype": "uint16_t", - "desc": "Always 1 (BF compatibility)", - "value": 1 - }, - { - "name": "bfCompatGyroNotch2Hz", - "ctype": "uint16_t", - "desc": "Always 0 (BF compatibility)", - "value": 0 - }, - { - "name": "bfCompatGyroNotch2Cutoff", - "ctype": "uint16_t", - "desc": "Always 1 (BF compatibility)", - "value": 1 - }, - { - "name": "accNotchHz", - "ctype": "uint16_t", - "desc": "Accelerometer notch filter center frequency (`accelerometerConfig()->acc_notch_hz`)", - "units": "Hz" - }, - { - "name": "accNotchCutoff", - "ctype": "uint16_t", - "desc": "Accelerometer notch filter cutoff frequency (`accelerometerConfig()->acc_notch_cutoff`)", - "units": "Hz" - }, - { - "name": "legacyGyroStage2LpfHz", - "ctype": "uint16_t", - "desc": "Always 0 (Legacy)", - "value": 0 - } - ] - }, - "notes": "", - "description": "Retrieves filter configuration settings (Gyro, D-term, Yaw, Accel). Some fields are BF compatibility placeholders or legacy." - }, - "MSP_SET_FILTER_CONFIG": { - "code": 93, - "mspv": 1, - "replaced_by": ["MSP2_COMMON_SET_SETTING"], - "request": { - "payload": [ - { - "name": "gyroMainLpfHz", - "ctype": "uint8_t", - "desc": "Sets `gyroConfigMutable()->gyro_main_lpf_hz`. (Size >= 5)", - "units": "Hz" - }, - { - "name": "dtermLpfHz", - "ctype": "uint16_t", - "desc": "Sets `pidProfileMutable()->dterm_lpf_hz` (constrained 0-500). (Size >= 5)", - "units": "Hz" - }, - { - "name": "yawLpfHz", - "ctype": "uint16_t", - "desc": "Sets `pidProfileMutable()->yaw_lpf_hz` (constrained 0-255). (Size >= 5)", - "units": "Hz" - }, - { - "name": "legacyGyroNotchHz", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 9)" - }, - { - "name": "legacyGyroNotchCutoff", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 9)" - }, - { - "name": "bfCompatDtermNotchHz", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 13)" - }, - { - "name": "bfCompatDtermNotchCutoff", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 13)" - }, - { - "name": "bfCompatGyroNotch2Hz", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 17)" - }, - { - "name": "bfCompatGyroNotch2Cutoff", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 17)" - }, - { - "name": "accNotchHz", - "ctype": "uint16_t", - "desc": "Sets `accelerometerConfigMutable()->acc_notch_hz` (constrained 0-255). (Size >= 21)", - "units": "Hz" - }, - { - "name": "accNotchCutoff", - "ctype": "uint16_t", - "desc": "Sets `accelerometerConfigMutable()->acc_notch_cutoff` (constrained 1-255). (Size >= 21)", - "units": "Hz" - }, - { - "name": "legacyGyroStage2LpfHz", - "ctype": "uint16_t", - "desc": "Ignored. (Size >= 22)" - } - ] - }, - "reply": null, - "notes": "Requires at least 22 bytes; intermediate length checks enforce legacy Betaflight frame layout and call `pidInitFilters()` once the D-term notch placeholders are consumed.", - "description": "Sets filter configuration settings. Handles different payload lengths for backward compatibility." - }, "MSP_PID_ADVANCED": { "code": 94, "mspv": 1, diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 1edf45749e2..734fbf29729 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1425,24 +1425,6 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU8(dst, 0); break; - case MSP_FILTER_CONFIG : - sbufWriteU8(dst, gyroConfig()->gyro_main_lpf_hz); - sbufWriteU16(dst, pidProfile()->dterm_lpf_hz); - sbufWriteU16(dst, pidProfile()->yaw_lpf_hz); - sbufWriteU16(dst, 0); //Was gyroConfig()->gyro_notch_hz - sbufWriteU16(dst, 1); //Was gyroConfig()->gyro_notch_cutoff - sbufWriteU16(dst, 0); //BF: pidProfile()->dterm_notch_hz - sbufWriteU16(dst, 1); //pidProfile()->dterm_notch_cutoff - - sbufWriteU16(dst, 0); //BF: masterConfig.gyro_soft_notch_hz_2 - sbufWriteU16(dst, 1); //BF: masterConfig.gyro_soft_notch_cutoff_2 - - sbufWriteU16(dst, accelerometerConfig()->acc_notch_hz); - sbufWriteU16(dst, accelerometerConfig()->acc_notch_cutoff); - - sbufWriteU16(dst, 0); //Was gyroConfig()->gyro_stage2_lowpass_hz - break; - case MSP_PID_ADVANCED: sbufWriteU16(dst, 0); // pidProfile()->rollPitchItermIgnoreRate sbufWriteU16(dst, 0); // pidProfile()->yawItermIgnoreRate @@ -2833,47 +2815,6 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) return MSP_RESULT_ERROR; break; - case MSP_SET_FILTER_CONFIG : - if (dataSize >= 5) { - gyroConfigMutable()->gyro_main_lpf_hz = sbufReadU8(src); - pidProfileMutable()->dterm_lpf_hz = constrain(sbufReadU16(src), 0, 500); - pidProfileMutable()->yaw_lpf_hz = constrain(sbufReadU16(src), 0, 255); - if (dataSize >= 9) { - sbufReadU16(src); //Was gyroConfigMutable()->gyro_notch_hz - sbufReadU16(src); //Was gyroConfigMutable()->gyro_notch_cutoff - } else { - return MSP_RESULT_ERROR; - } - if (dataSize >= 13) { - sbufReadU16(src); - sbufReadU16(src); - pidInitFilters(); - } else { - return MSP_RESULT_ERROR; - } - if (dataSize >= 17) { - sbufReadU16(src); // Was gyroConfigMutable()->gyro_soft_notch_hz_2 - sbufReadU16(src); // Was gyroConfigMutable()->gyro_soft_notch_cutoff_2 - } else { - return MSP_RESULT_ERROR; - } - - if (dataSize >= 21) { - accelerometerConfigMutable()->acc_notch_hz = constrain(sbufReadU16(src), 0, 255); - accelerometerConfigMutable()->acc_notch_cutoff = constrain(sbufReadU16(src), 1, 255); - } else { - return MSP_RESULT_ERROR; - } - - if (dataSize >= 22) { - sbufReadU16(src); //Was gyro_stage2_lowpass_hz - } else { - return MSP_RESULT_ERROR; - } - } else - return MSP_RESULT_ERROR; - break; - case MSP_SET_PID_ADVANCED: if (dataSize == 17) { sbufReadU16(src); // pidProfileMutable()->rollPitchItermIgnoreRate diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index 6b4705a738c..78387a903f0 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -202,8 +202,6 @@ #define MSP_ADVANCED_CONFIG 90 #define MSP_SET_ADVANCED_CONFIG 91 -#define MSP_FILTER_CONFIG 92 //DEPRECATED in INAV 9.1 - use settings system instead. Will be removed in INAV 10.0 -#define MSP_SET_FILTER_CONFIG 93 //DEPRECATED in INAV 9.1 - use settings system instead. Will be removed in INAV 10.0 #define MSP_PID_ADVANCED 94 //DEPRECATED in INAV 9.1 - use MSP_INAV_PID instead. Will be removed in INAV 10.0 #define MSP_SET_PID_ADVANCED 95 //DEPRECATED in INAV 9.1 - use MSP_SET_INAV_PID instead. Will be removed in INAV 10.0