diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index 8c6eaea463..a7a27b4ede 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -268,7 +268,8 @@ static bool motorsUseHardwareTimers(void) static bool servosUseHardwareTimers(void) { - return servoConfig()->servo_protocol == SERVO_TYPE_PWM; + return servoConfig()->servo_protocol == SERVO_TYPE_PWM || + servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM; } static void pwmInitMotors(timMotorServoHardware_t * timOutputs) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 2c8b8f83a5..7efbf39431 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -52,7 +52,8 @@ typedef enum { typedef enum { SERVO_TYPE_PWM = 0, SERVO_TYPE_SERVO_DRIVER, - SERVO_TYPE_SBUS + SERVO_TYPE_SBUS, + SERVO_TYPE_SBUS_PWM } servoProtocolType_e; typedef enum { diff --git a/src/main/drivers/pwm_output.c b/src/main/drivers/pwm_output.c index 5f61be7495..acfc89df46 100644 --- a/src/main/drivers/pwm_output.c +++ b/src/main/drivers/pwm_output.c @@ -501,6 +501,14 @@ static void pwmServoWriteStandard(uint8_t index, uint16_t value) } } +#ifdef USE_SERVO_SBUS +static void sbusPwmWriteStandard(uint8_t index, uint16_t value) +{ + pwmServoWriteStandard(index, value); + sbusServoUpdate(index, value); +} +#endif + #ifdef USE_PWM_SERVO_DRIVER static void pwmServoWriteExternalDriver(uint8_t index, uint16_t value) { @@ -532,6 +540,11 @@ void pwmServoPreconfigure(void) sbusServoInitialize(); servoWritePtr = sbusServoUpdate; break; + + case SERVO_TYPE_SBUS_PWM: + sbusServoInitialize(); + servoWritePtr = sbusPwmWriteStandard; + break; #endif } } diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 627fd350b5..5fcf8a6d11 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -217,7 +217,7 @@ void validateAndFixConfig(void) #endif #ifndef USE_SERVO_SBUS - if (servoConfig()->servo_protocol == SERVO_TYPE_SBUS) { + if (servoConfig()->servo_protocol == SERVO_TYPE_SBUS || servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM) { servoConfigMutable()->servo_protocol = SERVO_TYPE_PWM; } #endif diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 260d5b2f63..d11f506231 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -346,7 +346,7 @@ void fcTasksInit(void) setTaskEnabled(TASK_STACK_CHECK, true); #endif #if defined(USE_PWM_SERVO_DRIVER) || defined(USE_SERVO_SBUS) - setTaskEnabled(TASK_PWMDRIVER, (servoConfig()->servo_protocol == SERVO_TYPE_SERVO_DRIVER) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS)); + setTaskEnabled(TASK_PWMDRIVER, (servoConfig()->servo_protocol == SERVO_TYPE_SERVO_DRIVER) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM)); #endif #ifdef USE_CMS #ifdef USE_MSP_DISPLAYPORT diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index f5fde879ef..c3e286d37e 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -34,7 +34,7 @@ tables: - name: motor_pwm_protocol values: ["STANDARD", "ONESHOT125", "ONESHOT42", "MULTISHOT", "BRUSHED", "DSHOT150", "DSHOT300", "DSHOT600", "DSHOT1200", "SERIALSHOT"] - name: servo_protocol - values: ["PWM", "SERVO_DRIVER", "SBUS"] + values: ["PWM", "SERVO_DRIVER", "SBUS", "SBUS_PWM"] - name: failsafe_procedure values: ["SET-THR", "DROP", "RTH", "NONE"] - name: current_sensor