Merge remote-tracking branch 'borisbstyle/betaflight' into betaflight
This commit is contained in:
commit
7baf8b1be7
|
@ -237,7 +237,7 @@ void resetEscAndServoConfig(escAndServoConfig_t *escAndServoConfig)
|
||||||
escAndServoConfig->maxthrottle = 1850;
|
escAndServoConfig->maxthrottle = 1850;
|
||||||
escAndServoConfig->mincommand = 1000;
|
escAndServoConfig->mincommand = 1000;
|
||||||
escAndServoConfig->servoCenterPulse = 1500;
|
escAndServoConfig->servoCenterPulse = 1500;
|
||||||
escAndServoConfig->escDesyncProtection = 0;
|
escAndServoConfig->escDesyncProtection = 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetFlight3DConfig(flight3DConfig_t *flight3DConfig)
|
void resetFlight3DConfig(flight3DConfig_t *flight3DConfig)
|
||||||
|
|
|
@ -633,7 +633,7 @@ void writeServos(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void writeMotors(uint8_t unsyncedPwm)
|
void writeMotors(uint8_t fastPwmProtocol, uint8_t unsyncedPwm)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ void writeMotors(uint8_t unsyncedPwm)
|
||||||
pwmWriteMotor(i, motor[i]);
|
pwmWriteMotor(i, motor[i]);
|
||||||
|
|
||||||
|
|
||||||
if (feature(FEATURE_ONESHOT125) && !unsyncedPwm) {
|
if (fastPwmProtocol && !unsyncedPwm) {
|
||||||
pwmCompleteOneshotMotorUpdate(motorCount);
|
pwmCompleteOneshotMotorUpdate(motorCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ void writeAllMotors(int16_t mc)
|
||||||
// Sends commands to all motors
|
// Sends commands to all motors
|
||||||
for (i = 0; i < motorCount; i++)
|
for (i = 0; i < motorCount; i++)
|
||||||
motor[i] = mc;
|
motor[i] = mc;
|
||||||
writeMotors(1);
|
writeMotors(1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopMotors(void)
|
void stopMotors(void)
|
||||||
|
|
|
@ -213,6 +213,6 @@ int servoDirection(int servoIndex, int fromChannel);
|
||||||
#endif
|
#endif
|
||||||
void mixerResetDisarmedMotors(void);
|
void mixerResetDisarmedMotors(void);
|
||||||
void mixTable(void);
|
void mixTable(void);
|
||||||
void writeMotors(uint8_t unsyncedPwm);
|
void writeMotors(uint8_t fastPwmProtocol, uint8_t unsyncedPwm);
|
||||||
void stopMotors(void);
|
void stopMotors(void);
|
||||||
void StopPwmAllMotors(void);
|
void StopPwmAllMotors(void);
|
||||||
|
|
|
@ -80,14 +80,14 @@ float calculateRate(int axis, const controlRateConfig_t *controlRateConfig) {
|
||||||
|
|
||||||
if (isSuperExpoActive()) {
|
if (isSuperExpoActive()) {
|
||||||
float rcFactor = (axis == YAW) ? (ABS(rcCommand[axis]) / 500.0f) : (ABS(rcCommand[axis]) / (500.0f * (controlRateConfig->rcRate8 / 100.0f)));
|
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);
|
angleRate = rcFactor * ((27 * rcCommand[axis]) / 16.0f);
|
||||||
} else {
|
} else {
|
||||||
angleRate = (float)((controlRateConfig->rates[axis] + 27) * rcCommand[axis]) / 16.0f;
|
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) {
|
uint16_t getDynamicKp(int axis, const pidProfile_t *pidProfile) {
|
||||||
|
|
|
@ -742,7 +742,7 @@ void subTaskMotorUpdate(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (motorControlEnable) {
|
if (motorControlEnable) {
|
||||||
writeMotors(masterConfig.use_unsyncedPwm);
|
writeMotors(masterConfig.fast_pwm_protocol, masterConfig.use_unsyncedPwm);
|
||||||
}
|
}
|
||||||
if (debugMode == DEBUG_PIDLOOP) {debug[3] = micros() - startTime;}
|
if (debugMode == DEBUG_PIDLOOP) {debug[3] = micros() - startTime;}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue