some cheap used junkyard Accelerometer #2225

MM5.10
This commit is contained in:
rusefillc 2021-10-06 11:07:46 -04:00
parent 41e8888cb4
commit 3ff5745b45
4 changed files with 20 additions and 2 deletions

View File

@ -43,6 +43,9 @@ static constexpr LogField fields[] = {
{tsOutputChannels.firmwareVersion, GAUGE_NAME_VERSION, "", 0},
{tsOutputChannels.accelerationX, GAUGE_NAME_ACCEL_X, "", 2},
{tsOutputChannels.accelerationY, GAUGE_NAME_ACCEL_Y, "", 2},
{tsOutputChannels.accelerationZ, GAUGE_NAME_ACCEL_Z, "", 2},
{tsOutputChannels.accelerationRoll, GAUGE_NAME_ACCEL_ROLL, "", 2},
{tsOutputChannels.accelerationYaw, GAUGE_NAME_ACCEL_YAW, "", 2},
{tsOutputChannels.debugIntField1, GAUGE_NAME_DEBUG_I1, "", 0},
{tsOutputChannels.debugIntField2, GAUGE_NAME_DEBUG_I2, "", 0},

View File

@ -141,13 +141,18 @@ static void processCanRxImu(const CANRxFrame& frame, efitick_t nowNt) {
float accY = getShiftedLSB_intel(frame, 4);
efiPrintf("CAN_rx MM5_10_YAW_Y %f %f", yaw, accY);
engine->sensors.accelerometer.yaw = yaw * MM5_10_RATE_QUANT;
engine->sensors.accelerometer.y = accY * MM5_10_ACC_QUANT;
} else if (CAN_SID(frame) == MM5_10_ROLL_X) {
float roll = getShiftedLSB_intel(frame, 0);
float accX = getShiftedLSB_intel(frame, 4);
efiPrintf("CAN_rx MM5_10_ROLL_X %f %f", roll, accX);
engine->sensors.accelerometer.roll = roll * MM5_10_RATE_QUANT;
engine->sensors.accelerometer.x = accX * MM5_10_ACC_QUANT;
} else if (CAN_SID(frame) == MM5_10_Z) {
float accZ = getShiftedLSB_intel(frame, 4);
engine->sensors.accelerometer.z = accZ * MM5_10_ACC_QUANT;
}
}

View File

@ -116,8 +116,8 @@ public enum Sensor {
debugIntField3(GAUGE_NAME_DEBUG_I3, SensorCategory.DEBUG, FieldType.INT, 204, 0, 5),
debugIntField4("debug i4", SensorCategory.DEBUG, FieldType.INT16, 208, 0, 5),
debugIntField5("debug i5", SensorCategory.DEBUG, FieldType.INT16, 210, 0, 5),
// accelerationX; // 212
// accelerationY; // 214
accelerationX(GAUGE_NAME_ACCEL_X, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 212, 1.0 / PACK_MULT_PERCENT, -3, 3, "G"),
accelerationY(GAUGE_NAME_ACCEL_Y, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 214, 1.0 / PACK_MULT_PERCENT, -3, 3, "G"),
tuneCrc16("tune crc16", SensorCategory.STATUS, FieldType.UINT16, 244, 0, 5),
@ -142,6 +142,10 @@ public enum Sensor {
vvtPositionB2I(GAUGE_NAME_VVT_B2I, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 292, 1.0 / PACK_MULT_ANGLE, 0, 5, "deg"),
vvtPositionB2E(GAUGE_NAME_VVT_B2E, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 294, 1.0 / PACK_MULT_ANGLE, 0, 5, "deg"),
accelerationZ(GAUGE_NAME_ACCEL_Z, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 308, 1.0 / PACK_MULT_PERCENT, -3, 3, "G"),
accelerationRoll(GAUGE_NAME_ACCEL_ROLL, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 310, 1.0 / PACK_MULT_PERCENT, -30, 30, "deg/s"),
accelerationYaw(GAUGE_NAME_ACCEL_YAW, SensorCategory.SENSOR_INPUTS, FieldType.INT16, 312, 1.0 / PACK_MULT_PERCENT, -30, 30, "deg/s"),
// Synthetic (console only) channels
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
;

View File

@ -66,6 +66,12 @@ public class SensorLogger {
Sensor.VSS,
Sensor.SPEED2RPM,
Sensor.accelerationX,
Sensor.accelerationY,
Sensor.accelerationZ,
Sensor.accelerationRoll,
Sensor.accelerationYaw,
Sensor.debugFloatField1,
Sensor.debugFloatField2,
Sensor.debugFloatField3,