From 25b10f50f638ef372096738a213ba459c4b0d664 Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Wed, 12 Jul 2017 11:38:31 +0200 Subject: [PATCH 1/3] Added dterm filter type to MSP_FILTER_CONFIG and MSP_SET_FILTER_CONFIG --- src/main/fc/fc_msp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 95cefe691..d94bc8eca 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1345,6 +1345,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn sbufWriteU16(dst, currentPidProfile->dterm_notch_cutoff); sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_hz_2); sbufWriteU16(dst, gyroConfig()->gyro_soft_notch_cutoff_2); + sbufWriteU8(dst, currentPidProfile->dterm_filter_type); break; case MSP_PID_ADVANCED: @@ -1745,6 +1746,9 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src) gyroConfigMutable()->gyro_soft_notch_hz_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 validateAndFixGyroConfig(); gyroInitFilters(); From 69494ce6d4e623c3eeb0261a7ae85b0932b7ca8e Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Wed, 12 Jul 2017 13:50:32 +0200 Subject: [PATCH 2/3] Added anti-gravity settings to MSP_PID_ADVANCED and MSP_SET_PID_ADVANCED --- src/main/fc/fc_msp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index d94bc8eca..908f1db2e 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1363,6 +1363,8 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn sbufWriteU16(dst, currentPidProfile->yawRateAccelLimit); sbufWriteU8(dst, currentPidProfile->levelAngleLimit); sbufWriteU8(dst, currentPidProfile->levelSensitivity); + sbufWriteU16(dst, currentPidProfile->itermThrottleThreshold); + sbufWriteU16(dst, currentPidProfile->itermAcceleratorGain); break; case MSP_SENSOR_CONFIG: @@ -1773,6 +1775,10 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src) currentPidProfile->levelAngleLimit = sbufReadU8(src); currentPidProfile->levelSensitivity = sbufReadU8(src); } + if (dataSize > 19) { + currentPidProfile->itermThrottleThreshold = sbufReadU16(src); + currentPidProfile->itermAcceleratorGain = sbufReadU16(src); + } pidInitConfig(currentPidProfile); break; From 4195823b72559e3fa317faf227405251a12cfdb5 Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Wed, 12 Jul 2017 14:43:08 +0200 Subject: [PATCH 3/3] Fix set anti_gravity_gain not lower than 1000 --- src/main/fc/settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/settings.c b/src/main/fc/settings.c index b2742f3e8..bfd59763d 100644 --- a/src/main/fc/settings.c +++ b/src/main/fc/settings.c @@ -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) }, { "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_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) }, { "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) },