mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 13:55:18 +03:00
corrected a bug that would cause motors to spin up after saving parameters in 3D mode, thx englishman.
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@443 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
c1d82bcf46
commit
134a37d811
3 changed files with 4 additions and 1 deletions
|
@ -354,7 +354,7 @@ bool pwmInit(drv_pwm_config_t *init)
|
||||||
pwmInConfig(port, pwmCallback, numInputs);
|
pwmInConfig(port, pwmCallback, numInputs);
|
||||||
numInputs++;
|
numInputs++;
|
||||||
} else if (mask & TYPE_M) {
|
} else if (mask & TYPE_M) {
|
||||||
motors[numMotors++] = pwmOutConfig(port, 1000000 / init->motorPwmRate, PULSE_1MS);
|
motors[numMotors++] = pwmOutConfig(port, 1000000 / init->motorPwmRate, init->idlePulse > 0 ? init->idlePulse : PULSE_1MS);
|
||||||
} else if (mask & TYPE_S) {
|
} else if (mask & TYPE_S) {
|
||||||
servos[numServos++] = pwmOutConfig(port, 1000000 / init->servoPwmRate, PULSE_1MS);
|
servos[numServos++] = pwmOutConfig(port, 1000000 / init->servoPwmRate, PULSE_1MS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ typedef struct drv_pwm_config_t {
|
||||||
uint8_t adcChannel; // steal one RC input for current sensor
|
uint8_t adcChannel; // steal one RC input for current sensor
|
||||||
uint16_t motorPwmRate;
|
uint16_t motorPwmRate;
|
||||||
uint16_t servoPwmRate;
|
uint16_t servoPwmRate;
|
||||||
|
uint16_t idlePulse; // PWM value to use when initializing the driver;
|
||||||
|
// default of zero means PULSE_1MS, otherwise set to given value. Used by 3D mode.
|
||||||
uint16_t failsafeThreshold;
|
uint16_t failsafeThreshold;
|
||||||
} drv_pwm_config_t;
|
} drv_pwm_config_t;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ int main(void)
|
||||||
pwm_params.extraServos = cfg.gimbal_flags & GIMBAL_FORWARDAUX;
|
pwm_params.extraServos = cfg.gimbal_flags & GIMBAL_FORWARDAUX;
|
||||||
pwm_params.motorPwmRate = mcfg.motor_pwm_rate;
|
pwm_params.motorPwmRate = mcfg.motor_pwm_rate;
|
||||||
pwm_params.servoPwmRate = mcfg.servo_pwm_rate;
|
pwm_params.servoPwmRate = mcfg.servo_pwm_rate;
|
||||||
|
pwm_params.idlePulse = feature(FEATURE_3D) ? mcfg.neutral3d : 0;
|
||||||
pwm_params.failsafeThreshold = cfg.failsafe_detect_threshold;
|
pwm_params.failsafeThreshold = cfg.failsafe_detect_threshold;
|
||||||
switch (mcfg.power_adc_channel) {
|
switch (mcfg.power_adc_channel) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue