mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Merge pull request #9619 from mikeller/add_motor_protocol_disabled
Added 'disabled' motor protocol and made it the default.
This commit is contained in:
commit
2101326a1d
17 changed files with 193 additions and 149 deletions
|
@ -595,41 +595,39 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
|
|||
#else
|
||||
sbufWriteU8(dst, 0); // 0 == FC
|
||||
#endif
|
||||
|
||||
// Target capabilities (uint8)
|
||||
#define TARGET_HAS_VCP_BIT 0
|
||||
#define TARGET_HAS_SOFTSERIAL_BIT 1
|
||||
#define TARGET_IS_UNIFIED_BIT 2
|
||||
#define TARGET_HAS_FLASH_BOOTLOADER_BIT 3
|
||||
#define TARGET_SUPPORTS_CUSTOM_DEFAULTS_BIT 4
|
||||
#define TARGET_HAS_CUSTOM_DEFAULTS_BIT 5
|
||||
#define TARGET_SUPPORTS_RX_BIND_BIT 6
|
||||
#define TARGET_ACC_NEEDS_CALIBRATION_BIT 7
|
||||
#define TARGET_HAS_VCP 0
|
||||
#define TARGET_HAS_SOFTSERIAL 1
|
||||
#define TARGET_IS_UNIFIED 2
|
||||
#define TARGET_HAS_FLASH_BOOTLOADER 3
|
||||
#define TARGET_SUPPORTS_CUSTOM_DEFAULTS 4
|
||||
#define TARGET_HAS_CUSTOM_DEFAULTS 5
|
||||
#define TARGET_SUPPORTS_RX_BIND 6
|
||||
|
||||
uint8_t targetCapabilities = 0;
|
||||
#ifdef USE_VCP
|
||||
targetCapabilities |= 1 << TARGET_HAS_VCP_BIT;
|
||||
targetCapabilities |= BIT(TARGET_HAS_VCP);
|
||||
#endif
|
||||
#if defined(USE_SOFTSERIAL1) || defined(USE_SOFTSERIAL2)
|
||||
targetCapabilities |= 1 << TARGET_HAS_SOFTSERIAL_BIT;
|
||||
targetCapabilities |= BIT(TARGET_HAS_SOFTSERIAL);
|
||||
#endif
|
||||
#if defined(USE_UNIFIED_TARGET)
|
||||
targetCapabilities |= 1 << TARGET_IS_UNIFIED_BIT;
|
||||
targetCapabilities |= BIT(TARGET_IS_UNIFIED);
|
||||
#endif
|
||||
#if defined(USE_FLASH_BOOT_LOADER)
|
||||
targetCapabilities |= 1 << TARGET_HAS_FLASH_BOOTLOADER_BIT;
|
||||
targetCapabilities |= BIT(TARGET_HAS_FLASH_BOOTLOADER);
|
||||
#endif
|
||||
#if defined(USE_CUSTOM_DEFAULTS)
|
||||
targetCapabilities |= 1 << TARGET_SUPPORTS_CUSTOM_DEFAULTS_BIT;
|
||||
targetCapabilities |= BIT(TARGET_SUPPORTS_CUSTOM_DEFAULTS);
|
||||
if (hasCustomDefaults()) {
|
||||
targetCapabilities |= 1 << TARGET_HAS_CUSTOM_DEFAULTS_BIT;
|
||||
targetCapabilities |= BIT(TARGET_HAS_CUSTOM_DEFAULTS);
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_RX_BIND)
|
||||
targetCapabilities |= (getRxBindSupported() << TARGET_SUPPORTS_RX_BIND_BIT);
|
||||
#endif
|
||||
|
||||
#if defined(USE_ACC)
|
||||
targetCapabilities |= (!accHasBeenCalibrated() << TARGET_ACC_NEEDS_CALIBRATION_BIT);
|
||||
if (getRxBindSupported()) {
|
||||
targetCapabilities |= BIT(TARGET_SUPPORTS_RX_BIND);
|
||||
}
|
||||
#endif
|
||||
|
||||
sbufWriteU8(dst, targetCapabilities);
|
||||
|
@ -667,9 +665,27 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
|
|||
// Added in API version 1.42
|
||||
sbufWriteU8(dst, systemConfig()->configurationState);
|
||||
|
||||
//Added in API version 1.43
|
||||
// Added in API version 1.43
|
||||
sbufWriteU16(dst, gyro.sampleRateHz); // informational so the configurator can display the correct gyro/pid frequencies in the drop-down
|
||||
|
||||
// Configuration warnings / problems (uint32_t)
|
||||
#define PROBLEM_ACC_NEEDS_CALIBRATION 0
|
||||
#define PROBLEM_MOTOR_PROTOCOL_DISABLED 1
|
||||
|
||||
uint32_t configurationProblems = 0;
|
||||
|
||||
#if defined(USE_ACC)
|
||||
if (!accHasBeenCalibrated()) {
|
||||
configurationProblems |= BIT(PROBLEM_ACC_NEEDS_CALIBRATION);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!checkMotorProtocolEnabled(&motorConfig()->dev, NULL)) {
|
||||
configurationProblems |= BIT(PROBLEM_MOTOR_PROTOCOL_DISABLED);
|
||||
}
|
||||
|
||||
sbufWriteU32(dst, configurationProblems);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2454,11 +2470,7 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
sbufReadU8(src); // was gyroConfigMutable()->gyro_sync_denom - removed in API 1.43
|
||||
pidConfigMutable()->pid_process_denom = sbufReadU8(src);
|
||||
motorConfigMutable()->dev.useUnsyncedPwm = sbufReadU8(src);
|
||||
#ifdef USE_DSHOT
|
||||
motorConfigMutable()->dev.motorPwmProtocol = constrain(sbufReadU8(src), 0, PWM_TYPE_MAX - 1);
|
||||
#else
|
||||
motorConfigMutable()->dev.motorPwmProtocol = constrain(sbufReadU8(src), 0, PWM_TYPE_BRUSHED);
|
||||
#endif
|
||||
motorConfigMutable()->dev.motorPwmProtocol = sbufReadU8(src);
|
||||
motorConfigMutable()->dev.motorPwmRate = sbufReadU16(src);
|
||||
if (sbufBytesRemaining(src) >= 2) {
|
||||
motorConfigMutable()->digitalIdleOffsetValue = sbufReadU16(src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue