mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Removed tricopter yaw gyro smoothing from imuUpdate
This commit is contained in:
parent
fe40472050
commit
318592b063
3 changed files with 7 additions and 15 deletions
|
@ -298,11 +298,13 @@ static void imuCalculateEstimatedAttitude(void)
|
||||||
imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
|
imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
|
||||||
}
|
}
|
||||||
|
|
||||||
void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t mixerMode)
|
void imuUpdate(rollAndPitchTrims_t *accelerometerTrims)
|
||||||
{
|
{
|
||||||
static int16_t gyroYawSmooth = 0;
|
|
||||||
|
|
||||||
gyroUpdate();
|
gyroUpdate();
|
||||||
|
gyroData[FD_ROLL] = gyroADC[FD_ROLL];
|
||||||
|
gyroData[FD_PITCH] = gyroADC[FD_PITCH];
|
||||||
|
gyroData[FD_YAW] = gyroADC[FD_YAW];
|
||||||
|
|
||||||
if (sensors(SENSOR_ACC)) {
|
if (sensors(SENSOR_ACC)) {
|
||||||
updateAccelerationReadings(accelerometerTrims); // TODO rename to accelerometerUpdate and rename many other 'Acceleration' references to be 'Accelerometer'
|
updateAccelerationReadings(accelerometerTrims); // TODO rename to accelerometerUpdate and rename many other 'Acceleration' references to be 'Accelerometer'
|
||||||
imuCalculateEstimatedAttitude();
|
imuCalculateEstimatedAttitude();
|
||||||
|
@ -311,16 +313,6 @@ void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t mixerMode)
|
||||||
accADC[Y] = 0;
|
accADC[Y] = 0;
|
||||||
accADC[Z] = 0;
|
accADC[Z] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gyroData[FD_ROLL] = gyroADC[FD_ROLL];
|
|
||||||
gyroData[FD_PITCH] = gyroADC[FD_PITCH];
|
|
||||||
|
|
||||||
if (mixerMode == MIXER_TRI) {
|
|
||||||
gyroData[FD_YAW] = (gyroYawSmooth * 2 + gyroADC[FD_YAW]) / 3;
|
|
||||||
gyroYawSmooth = gyroData[FD_YAW];
|
|
||||||
} else {
|
|
||||||
gyroData[FD_YAW] = gyroADC[FD_YAW];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t calculateThrottleAngleCorrection(uint8_t throttle_correction_value)
|
int16_t calculateThrottleAngleCorrection(uint8_t throttle_correction_value)
|
||||||
|
|
|
@ -62,7 +62,7 @@ void imuConfigure(
|
||||||
);
|
);
|
||||||
|
|
||||||
void calculateEstimatedAltitude(uint32_t currentTime);
|
void calculateEstimatedAltitude(uint32_t currentTime);
|
||||||
void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t mixerMode);
|
void imuUpdate(rollAndPitchTrims_t *accelerometerTrims);
|
||||||
float calculateThrottleAngleScale(uint16_t throttle_correction_angle);
|
float calculateThrottleAngleScale(uint16_t throttle_correction_angle);
|
||||||
int16_t calculateThrottleAngleCorrection(uint8_t throttle_correction_value);
|
int16_t calculateThrottleAngleCorrection(uint8_t throttle_correction_value);
|
||||||
float calculateAccZLowPassFilterRCTimeConstant(float accz_lpf_cutoff);
|
float calculateAccZLowPassFilterRCTimeConstant(float accz_lpf_cutoff);
|
||||||
|
|
|
@ -720,7 +720,7 @@ void loop(void)
|
||||||
if (masterConfig.looptime == 0 || (int32_t)(currentTime - loopTime) >= 0) {
|
if (masterConfig.looptime == 0 || (int32_t)(currentTime - loopTime) >= 0) {
|
||||||
loopTime = currentTime + masterConfig.looptime;
|
loopTime = currentTime + masterConfig.looptime;
|
||||||
|
|
||||||
imuUpdate(¤tProfile->accelerometerTrims, masterConfig.mixerMode);
|
imuUpdate(¤tProfile->accelerometerTrims);
|
||||||
|
|
||||||
// Measure loop rate just after reading the sensors
|
// Measure loop rate just after reading the sensors
|
||||||
currentTime = micros();
|
currentTime = micros();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue