Merge pull request #7795 from etracer65/dshot_bidir_protocol_check

Disable DSHOT Telemetry if motor protocol is not DSHOT or PROSHOT
This commit is contained in:
Michael Keller 2019-03-18 19:33:20 +13:00 committed by GitHub
commit 4c62d362ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -441,7 +441,21 @@ static void validateAndFixConfig(void)
#endif
#if defined(USE_DSHOT_TELEMETRY)
if ((motorConfig()->dev.useBurstDshot || !systemConfig()->schedulerOptimizeRate)
bool usingDshotProtocol;
switch (motorConfig()->dev.motorPwmProtocol) {
case PWM_TYPE_PROSHOT1000:
case PWM_TYPE_DSHOT1200:
case PWM_TYPE_DSHOT600:
case PWM_TYPE_DSHOT300:
case PWM_TYPE_DSHOT150:
usingDshotProtocol = true;
break;
default:
usingDshotProtocol = false;
break;
}
if ((!usingDshotProtocol || motorConfig()->dev.useBurstDshot || !systemConfig()->schedulerOptimizeRate)
&& motorConfig()->dev.useDshotTelemetry) {
motorConfigMutable()->dev.useDshotTelemetry = false;
}