sanity in IMU data names/ranges

This commit is contained in:
Matthew Kennedy 2023-11-27 04:30:18 -05:00 committed by rusefillc
parent f0520e42a6
commit d31f535ca3
8 changed files with 25 additions and 52 deletions

View File

@ -114,9 +114,8 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
int16_t autoscale rawIdlePositionSensor;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale rawWastegatePosition;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
! todo: reimplement { LIS302DLCsPin != 0 || imuType != 0 }
int16_t autoscale accelerationX;@@GAUGE_NAME_ACCEL_X@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale accelerationY;@@GAUGE_NAME_ACCEL_Y@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 2
int16_t autoscale accelerationLat;@@GAUGE_NAME_ACCEL_LAT@@;"G",{1/1000}, 0, 0, 0, 0
int16_t autoscale accelerationLon;@@GAUGE_NAME_ACCEL_LON@@;"G",{1/1000}, 0, 0, 0, 0
uint8_t detectedGear;@@GAUGE_NAME_DETECTED_GEAR@@;"", 1, 0, 0, @@TCU_GEAR_COUNT@@, 0
uint8_t maxTriggerReentrant;;"", 1, 0, 0, 100, 0
@ -207,9 +206,8 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2
int16_t autoscale rawTps2Secondary;;"V",{1/@@PACK_MULT_VOLTAGE@@}, 0, 0, 5, 3
int16_t autoscale accelerationZ;@@GAUGE_NAME_ACCEL_Z@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
int16_t autoscale accelerationRoll;@@GAUGE_NAME_ACCEL_ROLL@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
int16_t autoscale accelerationYaw;@@GAUGE_NAME_ACCEL_YAW@@;"G",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
int16_t autoscale accelerationVert;@@GAUGE_NAME_ACCEL_VERT@@;"G",{1/1000}, 0, 0, 0, 0
int16_t autoscale gyroYaw;@@GAUGE_NAME_GYRO_YAW@@;"deg/sec",{1/1000}, 0, 0, 0, 0
int8_t[4 iterate] vvtTargets;;"deg",1, 0, 0, 0, 0
uint16_t turboSpeed;@@GAUGE_NAME_TURBO_SPEED@@;"hz",1, 0, 0, 0, 0

View File

@ -633,11 +633,10 @@ void updateTunerStudioState() {
tsOutputChannels->engineMode = packEngineMode();
tsOutputChannels->firmwareVersion = getRusEfiVersion();
tsOutputChannels->accelerationX = engine->sensors.accelerometer.x;
tsOutputChannels->accelerationY = engine->sensors.accelerometer.y;
tsOutputChannels->accelerationZ = engine->sensors.accelerometer.z;
tsOutputChannels->accelerationRoll = engine->sensors.accelerometer.roll;
tsOutputChannels->accelerationYaw = engine->sensors.accelerometer.yaw;
tsOutputChannels->accelerationLat = engine->sensors.accelerometer.lat;
tsOutputChannels->accelerationLon = engine->sensors.accelerometer.lon;
tsOutputChannels->accelerationVert = engine->sensors.accelerometer.vert;
tsOutputChannels->gyroYaw = engine->sensors.accelerometer.yawRate;
#if EFI_DYNO_VIEW
tsOutputChannels->VssAcceleration = getDynoviewAcceleration();

View File

@ -13,11 +13,10 @@
#define MOCK_ADC_SIZE 26
struct Accelerometer {
float x = 0; // G value
float y = 0;
float z = 0;
float yaw = 0;
float roll = 0;
float lat = 0; // G value
float lon = 0;
float vert = 0;
float yawRate = 0;
};
struct SensorsState {

View File

@ -111,23 +111,21 @@ static void processCanRxImu_BoschM5_10_YawY(const CANRxFrame& frame) {
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;
engine->sensors.accelerometer.yawRate = yaw * MM5_10_RATE_QUANT;
engine->sensors.accelerometer.lat = accY * MM5_10_ACC_QUANT;
}
static void processCanRxImu_BoschM5_10_RollX(const CANRxFrame& frame) {
float roll = getShiftedLSB_intel(frame, 0);
float accX = getShiftedLSB_intel(frame, 4);
efiPrintf("CAN_rx MM5_10_ROLL_X %f %f", roll, accX);
efiPrintf("CAN_rx MM5_10_ROLL_X %f", accX);
engine->sensors.accelerometer.roll = roll * MM5_10_RATE_QUANT;
engine->sensors.accelerometer.x = accX * MM5_10_ACC_QUANT;
engine->sensors.accelerometer.lon = accX * MM5_10_ACC_QUANT;
}
static void processCanRxImu_BoschM5_10_Z(const CANRxFrame& frame) {
float accZ = getShiftedLSB_intel(frame, 4);
efiPrintf("CAN_rx MM5_10_Z %f", accZ);
engine->sensors.accelerometer.z = accZ * MM5_10_ACC_QUANT;
engine->sensors.accelerometer.vert = accZ * MM5_10_ACC_QUANT;
}
static void processCanRxImu(const CANRxFrame& frame) {

View File

@ -94,12 +94,3 @@ void initAccelerometer() {
}
#endif /* EFI_MEMS */
float getLongitudinalAcceleration() {
return engine->sensors.accelerometer.x;
}
float getTransverseAcceleration() {
return engine->sensors.accelerometer.y;
}

View File

@ -8,13 +8,3 @@
#pragma once
void initAccelerometer();
/**
* Acceleration/braking
*/
float getLongitudinalAcceleration();
/**
* Turns
*/
float getTransverseAcceleration();

View File

@ -105,11 +105,10 @@
#define GAUGE_NAME_FUEL_TEMPERATURE "Fuel Temperature"
#define GAUGE_NAME_FLEX "Flex Ethanol %"
#define GAUGE_NAME_ACCEL_X "Acceleration: X"
#define GAUGE_NAME_ACCEL_Y "Acceleration: Y"
#define GAUGE_NAME_ACCEL_Z "Acceleration: Z"
#define GAUGE_NAME_ACCEL_ROLL "Acceleration: Roll"
#define GAUGE_NAME_ACCEL_YAW "Acceleration: Yaw"
#define GAUGE_NAME_ACCEL_LAT "Accel: Lateral"
#define GAUGE_NAME_ACCEL_LON "Accel: Longitudinal"
#define GAUGE_NAME_ACCEL_VERT "Accel: Vertical"
#define GAUGE_NAME_GYRO_YAW "Gyro: Yaw rate"
#define GAUGE_NAME_BARO_PRESSURE "Barometric pressure"

View File

@ -1451,11 +1451,10 @@ gaugeCategory = Sensors - Extra 1
AuxL2Gauge = auxLinear2, @@GAUGE_NAME_AUX_LINEAR_2@@, "", -100, 100, -100, -100, 100, 100, 2, 2
gaugeCategory = Sensors - Extra 2
accelerationXGauge = accelerationX, @@GAUGE_NAME_ACCEL_X@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationYGauge = accelerationY, @@GAUGE_NAME_ACCEL_Y@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationZGauge = accelerationZ, @@GAUGE_NAME_ACCEL_Z@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationRollGauge=accelerationRoll, @@GAUGE_NAME_ACCEL_ROLL@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationYawGauge=accelerationYaw, @@GAUGE_NAME_ACCEL_YAW@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationLatGauge = accelerationLat, @@GAUGE_NAME_ACCEL_LAT@@, "acc", -2, 2, -2, -1, 1, 2, 3, 1
accelerationLonGauge = accelerationLon, @@GAUGE_NAME_ACCEL_LON@@, "acc", -2, 2, -2, -1, 1, 2, 3, 1
accelerationVertGauge = accelerationVert, @@GAUGE_NAME_ACCEL_VERT@@, "acc", 0, 1.5, 0.5, 0.6, 1.4, 1.5, 3, 1
gyroYawGauge = gyroYaw, @@GAUGE_NAME_GYRO_YAW@@, "acc", -100, 100, -100, -100, 100, 100, 3, 1
egt1Gauge = egt1, "EGT#1", "C", 0, 2000
egt2Gauge = egt2, "EGT#2", "C", 0, 2000
rpmAccelerationGa = rpmAcceleration, "rpm delta", "RPM/s", -2000, 2000, -2000, 2000, -2000, 2000, 0, 0