1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 05:15:18 +03:00

[X-LiteS] Gyro fixes (ouille ouille !)

This commit is contained in:
Bertrand Songis 2019-04-02 20:55:29 +02:00
parent a13ee14bbb
commit e9231a2c77
2 changed files with 8 additions and 8 deletions

View file

@ -24,19 +24,19 @@
Gyro gyro;
void GyroBuffer::read(int32_t values[GYRO_SAMPLES_COUNT])
void GyroBuffer::read(int32_t values[GYRO_VALUES_COUNT])
{
for (uint8_t i = 0; i < GYRO_VALUES_COUNT; i++) {
sums[index] -= samples[index].values[i];
}
index = (index + 1) & (GYRO_SAMPLES_COUNT - 1);
for (uint8_t i = 0; i < GYRO_VALUES_COUNT; i++) {
sums[i] -= samples[index].values[i];
}
gyroRead(samples[index].raw);
for (uint8_t i = 0; i < GYRO_VALUES_COUNT; i++) {
sums[index] += samples[index].values[i];
values[i] = sums[index] >> GYRO_SAMPLES_EXPONENT;
sums[i] += samples[index].values[i];
values[i] = sums[i] >> GYRO_SAMPLES_EXPONENT;
}
}