1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Merge pull request #44 from DTFUHF/master

Have servos output midrc at startup
This commit is contained in:
dongie 2014-02-18 15:40:43 +09:00
commit 75ae09454b
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: