1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-22 07:45:29 +03:00

Moved gyro filter settings into gyroConfig

This commit is contained in:
Martin Budden 2016-11-23 19:04:14 +00:00
parent fa4d04b5a7
commit 2c7d06a94e
9 changed files with 59 additions and 81 deletions

View file

@ -1094,15 +1094,15 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
break;
case MSP_FILTER_CONFIG :
sbufWriteU8(dst, masterConfig.gyro_soft_lpf_hz);
sbufWriteU8(dst, masterConfig.gyroConfig.gyro_soft_lpf_hz);
sbufWriteU16(dst, currentProfile->pidProfile.dterm_lpf_hz);
sbufWriteU16(dst, currentProfile->pidProfile.yaw_lpf_hz);
sbufWriteU16(dst, masterConfig.gyro_soft_notch_hz_1);
sbufWriteU16(dst, masterConfig.gyro_soft_notch_cutoff_1);
sbufWriteU16(dst, masterConfig.gyroConfig.gyro_soft_notch_hz_1);
sbufWriteU16(dst, masterConfig.gyroConfig.gyro_soft_notch_cutoff_1);
sbufWriteU16(dst, currentProfile->pidProfile.dterm_notch_hz);
sbufWriteU16(dst, currentProfile->pidProfile.dterm_notch_cutoff);
sbufWriteU16(dst, masterConfig.gyro_soft_notch_hz_2);
sbufWriteU16(dst, masterConfig.gyro_soft_notch_cutoff_2);
sbufWriteU16(dst, masterConfig.gyroConfig.gyro_soft_notch_hz_2);
sbufWriteU16(dst, masterConfig.gyroConfig.gyro_soft_notch_cutoff_2);
break;
case MSP_PID_ADVANCED:
@ -1445,28 +1445,22 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
break;
case MSP_SET_FILTER_CONFIG:
masterConfig.gyro_soft_lpf_hz = sbufReadU8(src);
masterConfig.gyroConfig.gyro_soft_lpf_hz = sbufReadU8(src);
currentProfile->pidProfile.dterm_lpf_hz = sbufReadU16(src);
currentProfile->pidProfile.yaw_lpf_hz = sbufReadU16(src);
if (dataSize > 5) {
masterConfig.gyro_soft_notch_hz_1 = sbufReadU16(src);
masterConfig.gyro_soft_notch_cutoff_1 = sbufReadU16(src);
masterConfig.gyroConfig.gyro_soft_notch_hz_1 = sbufReadU16(src);
masterConfig.gyroConfig.gyro_soft_notch_cutoff_1 = sbufReadU16(src);
currentProfile->pidProfile.dterm_notch_hz = sbufReadU16(src);
currentProfile->pidProfile.dterm_notch_cutoff = sbufReadU16(src);
}
if (dataSize > 13) {
masterConfig.gyro_soft_notch_hz_2 = sbufReadU16(src);
masterConfig.gyro_soft_notch_cutoff_2 = sbufReadU16(src);
masterConfig.gyroConfig.gyro_soft_notch_hz_2 = sbufReadU16(src);
masterConfig.gyroConfig.gyro_soft_notch_cutoff_2 = sbufReadU16(src);
}
// reinitialize the gyro filters with the new values
validateAndFixGyroConfig();
gyroUseConfig(&masterConfig.gyroConfig,
masterConfig.gyro_soft_lpf_hz,
masterConfig.gyro_soft_notch_hz_1,
masterConfig.gyro_soft_notch_cutoff_1,
masterConfig.gyro_soft_notch_hz_2,
masterConfig.gyro_soft_notch_cutoff_2,
masterConfig.gyro_soft_type);
gyroUseConfig(&masterConfig.gyroConfig);
gyroInit();
// reinitialize the PID filters with the new values
pidInitFilters(&currentProfile->pidProfile);