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:
processCanRxVss(frame, nowNt);
// todo: convert to CanListener or not?
processCanRxImu(frame);
if (!engineConfiguration->useSpiImu) {
// todo: convert to CanListener or not?
processCanRxImu(frame);
}
processCanBenchTest(frame);

View File

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