diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index f11a34972e..b581776790 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -201,6 +201,10 @@ static void printSensors(Logging *log, bool fileFormat) { reportSensorF(log, fileFormat, "IAT", "C", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE), 2); // log column #7 } + + reportSensorF(log, fileFormat, GAUGE_NAME_ACCEL_X, "G", engine->sensors.accelerometer.x, 3); + reportSensorF(log, fileFormat, GAUGE_NAME_ACCEL_Y, "G", engine->sensors.accelerometer.y, 3); + if (hasMafSensor()) { reportSensorF(log, fileFormat, "maf", "V", getMaf(PASS_ENGINE_PARAMETER_SIGNATURE), 2); reportSensorF(log, fileFormat, "mafr", "kg/hr", getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE), 2); diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 3646ed5b81..6713f64c49 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -1583,6 +1583,9 @@ #define GAUGE_NAME_VBAT "VBatt" #define GAUGE_NAME_ENGINE_LOAD "Engine Load" #define GAUGE_NAME_CPU_TEMP "CPU Temperature" +#define GAUGE_NAME_ACCEL_X "Acceleration: X" +#define GAUGE_NAME_ACCEL_Y "Acceleration: Y" +#define GAUGE_NAME_ACCEL_Z "Acceleration: Z" #define INDICATOR_NAME_CLUTCH_UP "clutch: up" #define INDICATOR_NAME_CLUTCH_DOWN "clutch: down" #define INDICATOR_NAME_BRAKE_DOWN "brake: down" diff --git a/firmware/hw_layer/accelerometer.cpp b/firmware/hw_layer/accelerometer.cpp index 3d7b31d2d6..3477e2d2fa 100644 --- a/firmware/hw_layer/accelerometer.cpp +++ b/firmware/hw_layer/accelerometer.cpp @@ -64,6 +64,7 @@ static msg_t ivThread(int param) { // todo: migrate to async SPI API? engine->sensors.accelerometer.x = (int8_t)lis302dlReadRegister(driver, LIS302DL_OUTX); engine->sensors.accelerometer.y = (int8_t)lis302dlReadRegister(driver, LIS302DL_OUTY); + chThdSleepMilliseconds(20); } #if defined __GNUC__ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index a764acb4c1..86f5fbc4d1 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -907,6 +907,11 @@ end_struct #define GAUGE_NAME_ENGINE_LOAD "Engine Load" #define GAUGE_NAME_CPU_TEMP "CPU Temperature" +#define GAUGE_NAME_ACCEL_X "Acceleration: X" +#define GAUGE_NAME_ACCEL_Y "Acceleration: Y" +#define GAUGE_NAME_ACCEL_Z "Acceleration: Z" + + #define INDICATOR_NAME_CLUTCH_UP "clutch: up" #define INDICATOR_NAME_CLUTCH_DOWN "clutch: down" #define INDICATOR_NAME_BRAKE_DOWN "brake: down" diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 9c2d4ae82c..65fc31ffed 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -63,7 +63,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Aug 28 21:53:25 EDT 2017 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Aug 28 22:50:54 EDT 2017 pageSize = 16376 page = 1 @@ -1025,8 +1025,8 @@ fileVersion = { 20161225 } firmwareVersion = scalar,U32, 264, "version_f", 1, 0 fuelPidCorrection = scalar, F32, 268, "ms", 1, 0 coilDutyCycle = scalar, F32, 272, "perc", 1, 0 - accelerationX = scalar, S16, 276, "acc", 100, 0 - accelerationY = scalar, S16, 276, "acc", 100, 0 + accelerationX = scalar, S16, 276, "G", 0.01, 0 + accelerationY = scalar, S16, 276, "G", 0.01, 0 ; todo: generate this section programatically LM_PLAIN_MAF = {0}, @@ -1352,8 +1352,8 @@ gaugeCategory = Sensors internalMcuTemperatureGauge = internalMcuTemperature, "internal temperature", "C", 0, 100, 0, 0, 100, 100, 0, 0 VSSGauge = vehicleSpeedKph, "Speed", "kmh", 0, 200, 0, 1, 3, 4, 1, 1 pedalPositionGauge = pedalPosition,"Throttle Pedal Position", "%", 0, 120, 10, 10, 100, 100, 1, 1 - accelerationXGauge = accelerationX, "accel X", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 - accelerationYGauge = accelerationY, "accel Y", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 + accelerationXGauge = accelerationX, "Acceleration: X", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 + accelerationYGauge = accelerationY, "Acceleration: Y", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 gaugeCategory = Spark Data ignadvGauge = ignitionAdvance, "Ignition Advance 1", "degrees", -100, 100, -999, -999, 999, 999, 1, 1 @@ -1463,8 +1463,8 @@ gaugeCategory = Fuel Data entry = coilDutyCycle, "dwell: coil duty cycle", float,"%.3f" entry = currentTargetAfr,"fuel: target AFR", float,"%.3f" - entry = accelerationX, "acc X", float,"%.2f" - entry = accelerationY, "acc Y", float,"%.2f" + entry = accelerationX, "Acceleration: X", float,"%.2f" + entry = accelerationY, "Acceleration: Y", float,"%.2f" entry = engineLoadAccelExtra, "fuel: engine load acceleration extra fuel",float, "%.3f" entry = engineLoadDelta, "fuel: load change",float, "%.3f" @@ -2203,6 +2203,7 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "SPI3 MOSI", spi3mosiPin, {is_enabled_spi_3 == 1} field = "SPI3 MISO", spi3misoPin, {is_enabled_spi_3 == 1} field = "SPI3 SCK", spi3sckPin, {is_enabled_spi_3 == 1} + field = "LIS302DLCsPin", LIS302DLCsPin, {is_enabled_spi_1 == 1} dialog = fuelClosedLoopDialog, "Fuel closed-loop correction" field = "Enabled", fuelClosedLoopCorrectionEnabled diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 2944459fbc..b56e4290c7 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -253,8 +253,8 @@ fileVersion = { 20161225 } firmwareVersion = scalar,U32, 264, "version_f", 1, 0 fuelPidCorrection = scalar, F32, 268, "ms", 1, 0 coilDutyCycle = scalar, F32, 272, "perc", 1, 0 - accelerationX = scalar, S16, 276, "acc", 100, 0 - accelerationY = scalar, S16, 276, "acc", 100, 0 + accelerationX = scalar, S16, 276, "G", 0.01, 0 + accelerationY = scalar, S16, 276, "G", 0.01, 0 ; todo: generate this section programatically LM_PLAIN_MAF = {0}, @@ -580,8 +580,8 @@ gaugeCategory = Sensors internalMcuTemperatureGauge = internalMcuTemperature, "internal temperature", "C", 0, 100, 0, 0, 100, 100, 0, 0 VSSGauge = vehicleSpeedKph, "Speed", "kmh", 0, 200, 0, 1, 3, 4, 1, 1 pedalPositionGauge = pedalPosition,"Throttle Pedal Position", "%", 0, 120, 10, 10, 100, 100, 1, 1 - accelerationXGauge = accelerationX, "accel X", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 - accelerationYGauge = accelerationY, "accel Y", "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1 + 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 gaugeCategory = Spark Data ignadvGauge = ignitionAdvance, "Ignition Advance 1", "degrees", -100, 100, -999, -999, 999, 999, 1, 1 @@ -691,8 +691,8 @@ gaugeCategory = Fuel Data entry = coilDutyCycle, @@GAUGE_NAME_DWELL_DUTY@@, float,"%.3f" entry = currentTargetAfr,@@GAUGE_NAME_TARGET_AFR@@, float,"%.3f" - entry = accelerationX, "acc X", float,"%.2f" - entry = accelerationY, "acc Y", float,"%.2f" + entry = accelerationX, @@GAUGE_NAME_ACCEL_X@@, float,"%.2f" + entry = accelerationY, @@GAUGE_NAME_ACCEL_Y@@, float,"%.2f" entry = engineLoadAccelExtra, @@GAUGE_NAME_FUEL_EL_EXTRA@@,float, "%.3f" entry = engineLoadDelta, "fuel: load change",float, "%.3f" @@ -1431,6 +1431,7 @@ cmd_stop_engine = "w\x00\x99\x00\x00" field = "SPI3 MOSI", spi3mosiPin, {is_enabled_spi_3 == 1} field = "SPI3 MISO", spi3misoPin, {is_enabled_spi_3 == 1} field = "SPI3 SCK", spi3sckPin, {is_enabled_spi_3 == 1} + field = "LIS302DLCsPin", LIS302DLCsPin, {is_enabled_spi_1 == 1} dialog = fuelClosedLoopDialog, "Fuel closed-loop correction" field = "Enabled", fuelClosedLoopCorrectionEnabled diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index ddfcc7cc5c..681c5d741f 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config; -// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Aug 28 20:53:46 EDT 2017 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Aug 28 22:50:54 EDT 2017 public class Fields { public static final int LE_COMMAND_LENGTH = 200; public static final int BLOCKING_FACTOR = 400; @@ -1085,6 +1085,9 @@ public class Fields { public static final String GAUGE_NAME_VBAT = "VBatt"; public static final String GAUGE_NAME_ENGINE_LOAD = "Engine Load"; public static final String GAUGE_NAME_CPU_TEMP = "CPU Temperature"; + public static final String GAUGE_NAME_ACCEL_X = "Acceleration: X"; + public static final String GAUGE_NAME_ACCEL_Y = "Acceleration: Y"; + public static final String GAUGE_NAME_ACCEL_Z = "Acceleration: Z"; public static final String INDICATOR_NAME_CLUTCH_UP = "clutch: up"; public static final String INDICATOR_NAME_CLUTCH_DOWN = "clutch: down"; public static final String INDICATOR_NAME_BRAKE_DOWN = "brake: down";