1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 15:25:36 +03:00

Add dynamic notch setttings to MSP (#8689)

Add dynamic notch setttings to MSP
This commit is contained in:
Michael Keller 2019-08-10 17:28:14 +12:00 committed by GitHub
commit b94da4a5ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1456,7 +1456,18 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
#endif
#if defined(USE_GYRO_DATA_ANALYSE)
// Added in MSP API 1.42
sbufWriteU8(dst, gyroConfig()->dyn_notch_range);
sbufWriteU8(dst, gyroConfig()->dyn_notch_width_percent);
sbufWriteU16(dst, gyroConfig()->dyn_notch_q);
sbufWriteU16(dst, gyroConfig()->dyn_notch_min_hz);
#else
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
#endif
break;
case MSP_PID_ADVANCED:
sbufWriteU16(dst, 0);
@ -2129,6 +2140,20 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
sbufReadU16(src);
#endif
}
if (sbufBytesRemaining(src) >= 6) {
// Added in MSP API 1.42
#if defined(USE_GYRO_DATA_ANALYSE)
gyroConfigMutable()->dyn_notch_range = sbufReadU8(src);
gyroConfigMutable()->dyn_notch_width_percent = sbufReadU8(src);
gyroConfigMutable()->dyn_notch_q = sbufReadU16(src);
gyroConfigMutable()->dyn_notch_min_hz = sbufReadU16(src);
#else
sbufReadU8(src);
sbufReadU8(src);
sbufReadU16(src);
sbufReadU16(src);
#endif
}
// reinitialize the gyro filters with the new values
validateAndFixGyroConfig();