1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Allowing the fake gyro and accel values to be set externally

This commit is contained in:
JOhn Aughey 2016-05-03 17:47:16 -05:00
parent faf1c9a6d2
commit 70130a1bcb

View file

@ -214,6 +214,7 @@ const extiConfig_t *selectMPUIntExtiConfig(void)
}
#ifdef USE_FAKE_GYRO
int16_t fake_gyro_values[XYZ_AXIS_COUNT] = { 0,0,0 };
static void fakeGyroInit(uint16_t lpf)
{
UNUSED(lpf);
@ -221,7 +222,10 @@ static void fakeGyroInit(uint16_t lpf)
static bool fakeGyroRead(int16_t *gyroADC)
{
memset(gyroADC, 0, sizeof(int16_t[XYZ_AXIS_COUNT]));
for (int i = 0; i < XYZ_AXIS_COUNT; ++i) {
gyroADC[i] = fake_gyro_values[i];
}
return true;
}
@ -241,9 +245,13 @@ bool fakeGyroDetect(gyro_t *gyro)
#endif
#ifdef USE_FAKE_ACC
int16_t fake_acc_values[XYZ_AXIS_COUNT] = {0,0,0};
static void fakeAccInit(void) {}
static bool fakeAccRead(int16_t *accData) {
memset(accData, 0, sizeof(int16_t[XYZ_AXIS_COUNT]));
for(int i=0;i<XYZ_AXIS_COUNT;++i) {
accData[i] = fake_acc_values[i];
}
return true;
}