1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +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; 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); 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); gyroRead(samples[index].raw);
for (uint8_t i = 0; i < GYRO_VALUES_COUNT; i++) { for (uint8_t i = 0; i < GYRO_VALUES_COUNT; i++) {
sums[index] += samples[index].values[i]; sums[i] += samples[index].values[i];
values[i] = sums[index] >> GYRO_SAMPLES_EXPONENT; values[i] = sums[i] >> GYRO_SAMPLES_EXPONENT;
} }
} }

View file

@ -35,7 +35,7 @@ class GyroBuffer {
uint8_t index; uint8_t index;
public: public:
void read(int32_t values[GYRO_SAMPLES_COUNT]); void read(int32_t values[GYRO_VALUES_COUNT]);
}; };
class Gyro { class Gyro {