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:
commit
75ae09454b
3 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue