1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Dynamic notch bandwidth back to Q

+ simplified frequency estimation
This commit is contained in:
KarateBrot 2021-06-11 00:16:21 +02:00
parent 12a4016ff0
commit 1ae31fd3d5
7 changed files with 34 additions and 58 deletions

View file

@ -1780,7 +1780,7 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
#if defined(USE_GYRO_DATA_ANALYSE)
sbufWriteU8(dst, 0); // DEPRECATED 1.43: dyn_notch_range
sbufWriteU8(dst, 0); // DEPRECATED 1.44: dyn_notch_width_percent
sbufWriteU16(dst, 0); // DEPRECATED 1.44: dyn_notch_q
sbufWriteU16(dst, gyroConfig()->dyn_notch_q);
sbufWriteU16(dst, gyroConfig()->dyn_notch_min_hz);
#else
sbufWriteU8(dst, 0);
@ -1809,10 +1809,8 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst)
#endif
#if defined(USE_GYRO_DATA_ANALYSE)
sbufWriteU8(dst, gyroConfig()->dyn_notch_count);
sbufWriteU16(dst, gyroConfig()->dyn_notch_bandwidth_hz);
#else
sbufWriteU8(dst, 0);
sbufWriteU16(dst, 0);
#endif
break;
@ -2656,7 +2654,7 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
#if defined(USE_GYRO_DATA_ANALYSE)
sbufReadU8(src); // DEPRECATED 1.43: dyn_notch_range
sbufReadU8(src); // DEPRECATED 1.44: dyn_notch_width_percent
sbufReadU16(src); // DEPRECATED 1.44: dyn_notch_q
gyroConfigMutable()->dyn_notch_q = sbufReadU16(src);
gyroConfigMutable()->dyn_notch_min_hz = sbufReadU16(src);
#else
sbufReadU8(src);
@ -2680,7 +2678,7 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
sbufReadU16(src);
#endif
}
if (sbufBytesRemaining(src) >= 4) {
if (sbufBytesRemaining(src) >= 2) {
// Added in MSP API 1.44
#if defined(USE_DYN_LPF)
currentPidProfile->dyn_lpf_curve_expo = sbufReadU8(src);
@ -2689,10 +2687,8 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
#endif
#if defined(USE_GYRO_DATA_ANALYSE)
gyroConfigMutable()->dyn_notch_count = sbufReadU8(src);
gyroConfigMutable()->dyn_notch_bandwidth_hz = sbufReadU16(src);
#else
sbufReadU8(src);
sbufReadU16(src);
#endif
}