Merge pull request #3500 from basdelfos/bfc_change_dterm_filter
Added dterm filter type and anti-gravity settings to MSP
This commit is contained in:
commit
98cac372fc
|
@ -1345,6 +1345,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
||||||
sbufWriteU16(dst, currentPidProfile->dterm_notch_cutoff);
|
sbufWriteU16(dst, currentPidProfile->dterm_notch_cutoff);
|
||||||
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_hz_2);
|
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_hz_2);
|
||||||
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_cutoff_2);
|
sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_cutoff_2);
|
||||||
|
sbufWriteU8(dst, currentPidProfile->dterm_filter_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_PID_ADVANCED:
|
case MSP_PID_ADVANCED:
|
||||||
|
@ -1362,6 +1363,8 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
||||||
sbufWriteU16(dst, currentPidProfile->yawRateAccelLimit);
|
sbufWriteU16(dst, currentPidProfile->yawRateAccelLimit);
|
||||||
sbufWriteU8(dst, currentPidProfile->levelAngleLimit);
|
sbufWriteU8(dst, currentPidProfile->levelAngleLimit);
|
||||||
sbufWriteU8(dst, currentPidProfile->levelSensitivity);
|
sbufWriteU8(dst, currentPidProfile->levelSensitivity);
|
||||||
|
sbufWriteU16(dst, currentPidProfile->itermThrottleThreshold);
|
||||||
|
sbufWriteU16(dst, currentPidProfile->itermAcceleratorGain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_SENSOR_CONFIG:
|
case MSP_SENSOR_CONFIG:
|
||||||
|
@ -1745,6 +1748,9 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
gyroConfigMutable()->gyro_soft_notch_hz_2 = sbufReadU16(src);
|
gyroConfigMutable()->gyro_soft_notch_hz_2 = sbufReadU16(src);
|
||||||
gyroConfigMutable()->gyro_soft_notch_cutoff_2 = sbufReadU16(src);
|
gyroConfigMutable()->gyro_soft_notch_cutoff_2 = sbufReadU16(src);
|
||||||
}
|
}
|
||||||
|
if (dataSize > 17) {
|
||||||
|
currentPidProfile->dterm_filter_type = sbufReadU8(src);
|
||||||
|
}
|
||||||
// reinitialize the gyro filters with the new values
|
// reinitialize the gyro filters with the new values
|
||||||
validateAndFixGyroConfig();
|
validateAndFixGyroConfig();
|
||||||
gyroInitFilters();
|
gyroInitFilters();
|
||||||
|
@ -1769,6 +1775,10 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
currentPidProfile->levelAngleLimit = sbufReadU8(src);
|
currentPidProfile->levelAngleLimit = sbufReadU8(src);
|
||||||
currentPidProfile->levelSensitivity = sbufReadU8(src);
|
currentPidProfile->levelSensitivity = sbufReadU8(src);
|
||||||
}
|
}
|
||||||
|
if (dataSize > 19) {
|
||||||
|
currentPidProfile->itermThrottleThreshold = sbufReadU16(src);
|
||||||
|
currentPidProfile->itermAcceleratorGain = sbufReadU16(src);
|
||||||
|
}
|
||||||
pidInitConfig(currentPidProfile);
|
pidInitConfig(currentPidProfile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -545,7 +545,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "vbat_pid_gain", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, vbatPidCompensation) },
|
{ "vbat_pid_gain", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, vbatPidCompensation) },
|
||||||
{ "pid_at_min_throttle", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, pidAtMinThrottle) },
|
{ "pid_at_min_throttle", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, pidAtMinThrottle) },
|
||||||
{ "anti_gravity_threshold", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 20, 1000 }, PG_PID_PROFILE, offsetof(pidProfile_t, itermThrottleThreshold) },
|
{ "anti_gravity_threshold", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 20, 1000 }, PG_PID_PROFILE, offsetof(pidProfile_t, itermThrottleThreshold) },
|
||||||
{ "anti_gravity_gain", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 1, 30000 }, PG_PID_PROFILE, offsetof(pidProfile_t, itermAcceleratorGain) },
|
{ "anti_gravity_gain", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 1000, 30000 }, PG_PID_PROFILE, offsetof(pidProfile_t, itermAcceleratorGain) },
|
||||||
{ "setpoint_relax_ratio", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 100 }, PG_PID_PROFILE, offsetof(pidProfile_t, setpointRelaxRatio) },
|
{ "setpoint_relax_ratio", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 100 }, PG_PID_PROFILE, offsetof(pidProfile_t, setpointRelaxRatio) },
|
||||||
{ "dterm_setpoint_weight", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 254 }, PG_PID_PROFILE, offsetof(pidProfile_t, dtermSetpointWeight) },
|
{ "dterm_setpoint_weight", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 254 }, PG_PID_PROFILE, offsetof(pidProfile_t, dtermSetpointWeight) },
|
||||||
{ "acc_limit_yaw", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 1, 500 }, PG_PID_PROFILE, offsetof(pidProfile_t, yawRateAccelLimit) },
|
{ "acc_limit_yaw", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 1, 500 }, PG_PID_PROFILE, offsetof(pidProfile_t, yawRateAccelLimit) },
|
||||||
|
|
Loading…
Reference in New Issue