From dcd865284268c324ebc9ffbd1b639d9ef045e5ff Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 11 Jul 2015 15:01:54 -0400 Subject: [PATCH] auto-sync --- firmware/console/binary/tunerstudio_configuration.h | 3 ++- firmware/console/status_loop.cpp | 4 ++++ firmware/hw_layer/HIP9011.cpp | 13 +++++++++++-- firmware/rusefi.cpp | 2 +- java_console/models/src/com/rusefi/core/Sensor.java | 1 + .../models/src/com/rusefi/core/SensorCentral.java | 1 + 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/firmware/console/binary/tunerstudio_configuration.h b/firmware/console/binary/tunerstudio_configuration.h index cffbbdb6d6..4f0c1bd544 100644 --- a/firmware/console/binary/tunerstudio_configuration.h +++ b/firmware/console/binary/tunerstudio_configuration.h @@ -95,7 +95,8 @@ typedef struct { float injectorDutyCycle; int knockCount; float fuelLevel; - int unused3[11]; + float knockLevel; + int unused3[10]; } TunerStudioOutputChannels; #endif /* TUNERSTUDIO_CONFIGURATION_H_ */ diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index cb4b1a33a6..eb1c71cc68 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -55,6 +55,8 @@ #include "settings.h" #include "rusefi_outputs.h" +extern float knockVolts; + extern bool_t main_loop_started; #if EFI_PROD_CODE || defined(__DOXYGEN__) @@ -185,6 +187,7 @@ static void printSensors(Logging *log, bool fileFormat) { #endif /* EFI_PROD_CODE */ reportSensorF(log, fileFormat, "ks", "count", engine->knockCount, 0); + reportSensorF(log, fileFormat, "kv", "v", knockVolts, 2); // reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2); @@ -592,6 +595,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->baroCorrection = engine->engineState.baroCorrection; tsOutputChannels->pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_F); tsOutputChannels->knockCount = engine->knockCount; + tsOutputChannels->knockLevel = knockVolts; tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER); tsOutputChannels->fuelLevel = engine->engineState.fuelLevel; tsOutputChannels->hasFatalError = hasFirmwareError(); diff --git a/firmware/hw_layer/HIP9011.cpp b/firmware/hw_layer/HIP9011.cpp index 77c3d00c10..a97a3ccc4b 100644 --- a/firmware/hw_layer/HIP9011.cpp +++ b/firmware/hw_layer/HIP9011.cpp @@ -58,6 +58,7 @@ static int settingUpdateCount = 0; static int totalKnockEventsCount = 0; static int currentPrescaler; static float hipValueMax = 0; +// todo: move this to engine state float knockVolts = 0; static int spiCount = 0; @@ -379,9 +380,17 @@ static THD_WORKING_AREA(hipTreadStack, UTILITY_THREAD_STACK_SIZE); static msg_t hipThread(void *arg) { chRegSetThreadName("hip9011 init"); + + // some time to let the hardware start + hipCs.setValue(true); + chThdSleepMilliseconds(100); + hipCs.setValue(false); + chThdSleepMilliseconds(100); + hipCs.setValue(true); + while (true) { - // some time to let the hardware start - chThdSleepMilliseconds(500); + chThdSleepMilliseconds(100); + if (needToInit) { hipStartupCode(); needToInit = false; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 1d24bb7528..fc004487fb 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -291,5 +291,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20150710; + return 20150711; } diff --git a/java_console/models/src/com/rusefi/core/Sensor.java b/java_console/models/src/com/rusefi/core/Sensor.java index d545d73c29..6d1f85563c 100644 --- a/java_console/models/src/com/rusefi/core/Sensor.java +++ b/java_console/models/src/com/rusefi/core/Sensor.java @@ -27,6 +27,7 @@ public enum Sensor { PPS("pedal", SensorCategory.SENSOR_INPUTS, "%", 100), VSS("Speed", SensorCategory.SENSOR_INPUTS, "kph", 100), KS("Knock", SensorCategory.SENSOR_INPUTS, "count", 30), + KV("Knock level", SensorCategory.SENSOR_INPUTS, "v", 6), ENGINE_LOAD("Engine Load", SensorCategory.SENSOR_INPUTS, "x", 300), diff --git a/java_console/models/src/com/rusefi/core/SensorCentral.java b/java_console/models/src/com/rusefi/core/SensorCentral.java index 2786cf626a..c75afe423d 100644 --- a/java_console/models/src/com/rusefi/core/SensorCentral.java +++ b/java_console/models/src/com/rusefi/core/SensorCentral.java @@ -103,6 +103,7 @@ public class SensorCentral { addDoubleSensor(Sensor.ADVANCE2, es); addDoubleSensor(Sensor.ADVANCE3, es); addDoubleSensor(Sensor.KS, es); + addDoubleSensor(Sensor.KV, es); addDoubleSensor("tch", Sensor.T_CHARGE, es); addDoubleSensor(Sensor.AFR, es);