IMU: select CAN vs SPI

This commit is contained in:
Andrey Gusakov 2023-12-18 19:18:20 +03:00 committed by rusefillc
parent f54d7d56bc
commit 6b957e33b7
2 changed files with 10 additions and 6 deletions

View File

@ -178,8 +178,10 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
//Vss is configurable, should we handle it here: //Vss is configurable, should we handle it here:
processCanRxVss(frame, nowNt); processCanRxVss(frame, nowNt);
if (!engineConfiguration->useSpiImu) {
// todo: convert to CanListener or not? // todo: convert to CanListener or not?
processCanRxImu(frame); processCanRxImu(frame);
}
processCanBenchTest(frame); processCanBenchTest(frame);

View File

@ -124,11 +124,13 @@ private:
lsm303agrAccelerometerReadCooked(&LIS2DH12, acccooked); lsm303agrAccelerometerReadCooked(&LIS2DH12, acccooked);
#endif #endif
if (engineConfiguration->useSpiImu) {
/* milli-G to G */ /* milli-G to G */
engine->sensors.accelerometer.lat = acccooked[0] / 1000.0; engine->sensors.accelerometer.lat = acccooked[0] / 1000.0;
engine->sensors.accelerometer.lon = acccooked[1] / 1000.0; engine->sensors.accelerometer.lon = acccooked[1] / 1000.0;
engine->sensors.accelerometer.vert = acccooked[2] / 1000.0; engine->sensors.accelerometer.vert = acccooked[2] / 1000.0;
} }
}
}; };
static AccelController instance; static AccelController instance;