diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index 3ffb9cdbfd..68a14e27f9 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -113,9 +113,8 @@ int16_t rpmAcceleration;dRPM;"RPM acceleration",1, 0, 0, 5, 2 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, @@GEARS_COUNT@@, 0 uint8_t maxTriggerReentrant;;"", 1, 0, 0, 100, 0 @@ -203,9 +202,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 diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 877d96bf30..1a34db5186 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -620,13 +620,10 @@ void updateTunerStudioState() { // 120 tsOutputChannels->firmwareVersion = getRusEfiVersion(); - // 276 - tsOutputChannels->accelerationX = engine->sensors.accelerometer.x; - // 278 - 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(); diff --git a/firmware/controllers/algo/engine_parts.h b/firmware/controllers/algo/engine_parts.h index 41fe1ef965..678363e68f 100644 --- a/firmware/controllers/algo/engine_parts.h +++ b/firmware/controllers/algo/engine_parts.h @@ -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 { diff --git a/firmware/controllers/can/can_rx.cpp b/firmware/controllers/can/can_rx.cpp index ae8bb8fcfc..d03db32305 100644 --- a/firmware/controllers/can/can_rx.cpp +++ b/firmware/controllers/can/can_rx.cpp @@ -139,23 +139,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) { diff --git a/firmware/hw_layer/sensors/accelerometer.cpp b/firmware/hw_layer/sensors/accelerometer.cpp index 7c5d55b02d..de5de50e82 100644 --- a/firmware/hw_layer/sensors/accelerometer.cpp +++ b/firmware/hw_layer/sensors/accelerometer.cpp @@ -94,12 +94,3 @@ void initAccelerometer() { } #endif /* EFI_MEMS */ - - -float getLongitudinalAcceleration() { - return engine->sensors.accelerometer.x; -} - -float getTransverseAcceleration() { - return engine->sensors.accelerometer.y; -} diff --git a/firmware/hw_layer/sensors/accelerometer.h b/firmware/hw_layer/sensors/accelerometer.h index 118f325df4..ea9374c25f 100644 --- a/firmware/hw_layer/sensors/accelerometer.h +++ b/firmware/hw_layer/sensors/accelerometer.h @@ -8,13 +8,3 @@ #pragma once void initAccelerometer(); - -/** - * Acceleration/braking - */ -float getLongitudinalAcceleration(); -/** - * Turns - */ -float getTransverseAcceleration(); - diff --git a/firmware/integration/rusefi_config_shared.txt b/firmware/integration/rusefi_config_shared.txt index 67c22b8b5a..6bdd233a10 100644 --- a/firmware/integration/rusefi_config_shared.txt +++ b/firmware/integration/rusefi_config_shared.txt @@ -90,11 +90,10 @@ #define GAUGE_NAME_FUEL_PRESSURE_HIGH_UNITS "bar" #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" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 66b96b2cdc..8ca63686da 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1357,11 +1357,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