1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 06:45:16 +03:00

Have servos output midrc at startup instead of 1ms pulse (full deflection)

This commit is contained in:
DTF UHF 2014-02-14 15:15:38 -05:00
parent 4e44cf62a2
commit ac94147589
3 changed files with 3 additions and 1 deletions

View file

@ -376,7 +376,7 @@ bool pwmInit(drv_pwm_config_t *init)
motors[numMotors++] = pwmOutConfig(port, mhz, hz / init->motorPwmRate, init->idlePulse);
} else if (mask & TYPE_S) {
servos[numServos++] = pwmOutConfig(port, PWM_TIMER_MHZ, 1000000 / init->servoPwmRate, PULSE_1MS);
servos[numServos++] = pwmOutConfig(port, PWM_TIMER_MHZ, 1000000 / init->servoPwmRate, init->servoCenterPulse);
}
}

View file

@ -18,6 +18,7 @@ typedef struct drv_pwm_config_t {
uint16_t servoPwmRate;
uint16_t idlePulse; // PWM value to use when initializing the driver. set this to either PULSE_1MS (regular pwm),
// some higher value (used by 3d mode), or 0, for brushed pwm drivers.
uint16_t servoCenterPulse;
uint16_t failsafeThreshold;
} drv_pwm_config_t;

View file

@ -73,6 +73,7 @@ int main(void)
pwm_params.idlePulse = mcfg.neutral3d;
if (pwm_params.motorPwmRate > 500)
pwm_params.idlePulse = 0; // brushed motors
pwm_params.servoCenterPulse = mcfg.midrc;
pwm_params.failsafeThreshold = cfg.failsafe_detect_threshold;
switch (mcfg.power_adc_channel) {
case 1: