Merge remote-tracking branch 'borisbstyle/betaflight' into betaflight

This commit is contained in:
Gary Keeble 2016-06-02 12:08:27 +01:00
commit 7baf8b1be7
5 changed files with 8 additions and 8 deletions

View File

@ -237,7 +237,7 @@ void resetEscAndServoConfig(escAndServoConfig_t *escAndServoConfig)
escAndServoConfig->maxthrottle = 1850;
escAndServoConfig->mincommand = 1000;
escAndServoConfig->servoCenterPulse = 1500;
escAndServoConfig->escDesyncProtection = 0;
escAndServoConfig->escDesyncProtection = 10000;
}
void resetFlight3DConfig(flight3DConfig_t *flight3DConfig)

View File

@ -633,7 +633,7 @@ void writeServos(void)
}
#endif
void writeMotors(uint8_t unsyncedPwm)
void writeMotors(uint8_t fastPwmProtocol, uint8_t unsyncedPwm)
{
uint8_t i;
@ -641,7 +641,7 @@ void writeMotors(uint8_t unsyncedPwm)
pwmWriteMotor(i, motor[i]);
if (feature(FEATURE_ONESHOT125) && !unsyncedPwm) {
if (fastPwmProtocol && !unsyncedPwm) {
pwmCompleteOneshotMotorUpdate(motorCount);
}
}
@ -653,7 +653,7 @@ void writeAllMotors(int16_t mc)
// Sends commands to all motors
for (i = 0; i < motorCount; i++)
motor[i] = mc;
writeMotors(1);
writeMotors(1,1);
}
void stopMotors(void)

View File

@ -213,6 +213,6 @@ int servoDirection(int servoIndex, int fromChannel);
#endif
void mixerResetDisarmedMotors(void);
void mixTable(void);
void writeMotors(uint8_t unsyncedPwm);
void writeMotors(uint8_t fastPwmProtocol, uint8_t unsyncedPwm);
void stopMotors(void);
void StopPwmAllMotors(void);

View File

@ -80,14 +80,14 @@ float calculateRate(int axis, const controlRateConfig_t *controlRateConfig) {
if (isSuperExpoActive()) {
float rcFactor = (axis == YAW) ? (ABS(rcCommand[axis]) / 500.0f) : (ABS(rcCommand[axis]) / (500.0f * (controlRateConfig->rcRate8 / 100.0f)));
rcFactor = 1.0f / (1.0f - (rcFactor * (controlRateConfig->rates[axis] / 100.0f)));
rcFactor = constrainf(1.0f / (1.0f - (rcFactor * (controlRateConfig->rates[axis] / 100.0f))), 0.01f, 1.00f);
angleRate = rcFactor * ((27 * rcCommand[axis]) / 16.0f);
} else {
angleRate = (float)((controlRateConfig->rates[axis] + 27) * rcCommand[axis]) / 16.0f;
}
return angleRate;
return constrainf(angleRate, -8190, 8290); // Rate limit protection
}
uint16_t getDynamicKp(int axis, const pidProfile_t *pidProfile) {

View File

@ -742,7 +742,7 @@ void subTaskMotorUpdate(void)
#endif
if (motorControlEnable) {
writeMotors(masterConfig.use_unsyncedPwm);
writeMotors(masterConfig.fast_pwm_protocol, masterConfig.use_unsyncedPwm);
}
if (debugMode == DEBUG_PIDLOOP) {debug[3] = micros() - startTime;}
}