From 44daac5baf5c40a8ddeeb5612c7e89d69c8ff4ed Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 30 Jul 2020 00:04:18 -0400 Subject: [PATCH] NA6 progress --- firmware/config/engines/mazda_miata_1_6.cpp | 24 +++++++++++++++++++ .../main/java/com/rusefi/tools/tune/TS2C.java | 10 ++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 8fa8f4e551..0691f4433d 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -19,6 +19,27 @@ EXTERN_CONFIG; +// todo: use these defaults wider? make them global defaults maybe? +static const float hardCodedcrankingCycleBins[8] = {1.0, 16.0, 35.0, 54.0, 76.0, 102.0, 132.0, 169.0}; +static const float hardCodedcrankingCycleCoef[8] = {1.9800034, 1.800003, 1.5999985, 1.4000015, 1.2300034, 1.1200027, 1.050003, 1.0199966}; + +/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ +static void setCrankingCycleBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->crankingCycleBins, hardCodedcrankingCycleBins); + MEMCPY(config->crankingCycleCoef, hardCodedcrankingCycleCoef); +} + +// todo: use these defaults wider? make them global defaults maybe? +static const float hardCodedcrankingFuelBins[8] = {-20.0, -10.0, 3.6799927, 22.77002, 34.049805, 49.95996, 65.0, 90.0}; +static const float hardCodedcrankingFuelCoef[8] = {2.7999878, 2.2000122, 1.6900024, 1.2900009, 1.199997, 1.050003, 1.0, 1.0}; + +/* Generated by TS2C on Thu Jul 30 00:03:20 EDT 2020*/ +static void setCrankingFuelBins(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + MEMCPY(config->crankingFuelBins, hardCodedcrankingFuelBins); + MEMCPY(config->crankingFuelCoef, hardCodedcrankingFuelCoef); +} + + static const float ve16RpmBins[FUEL_RPM_COUNT] = { 650.0,1100.0,1550.0,2000.0, 2450.0,2900.0,3350.0,3800.0, @@ -111,6 +132,9 @@ static void miataNAcommonEngineSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) { MEMCPY(config->ignitionTable, mapBased16IgnitionTable); #endif + setCrankingCycleBins(PASS_CONFIG_PARAMETER_SIGNATURE); + setCrankingFuelBins(PASS_CONFIG_PARAMETER_SIGNATURE); + engineConfiguration->idle.solenoidFrequency = 160; engineConfiguration->ignitionMode = IM_WASTED_SPARK; } diff --git a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java index 90949f02d2..227f602544 100644 --- a/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java +++ b/java_console/models/src/main/java/com/rusefi/tools/tune/TS2C.java @@ -15,6 +15,7 @@ import java.util.Date; */ @SuppressWarnings("StringConcatenationInsideStringBufferAppend") public class TS2C { + static final String FINGER_PRINT = "/* Generated by " + TS2C.class.getSimpleName() + " on " + new Date() + "*/\r\n"; // todo: replace with loadCount & rpmCount private int size; @@ -74,11 +75,12 @@ public class TS2C { BufferedReader r = readAndScroll(msqFileName, tableName); readTable(table, r); - writeTable(w, (loadIndex, rpmIndex) -> table[loadIndex][rpmIndex], "TS2C"); + writeTable(w, (loadIndex, rpmIndex) -> table[loadIndex][rpmIndex]); w.write("\r\n\r\n"); } - w.write("static void set" + methodName + "() {\n"); + w.write(FINGER_PRINT); + w.write("static void set" + methodName + "(DECLARE_CONFIG_PARAMETER_SIGNATURE) {\n"); w.write("\tMEMCPY(config->" + loadSectionName + ", hardCoded" + loadSectionName + ");\n"); w.write("\tMEMCPY(config->" + rpmSectionName + ", hardCoded" + rpmSectionName + ");\n"); @@ -92,8 +94,8 @@ public class TS2C { w.close(); } - private void writeTable(BufferedWriter w, ValueSource valueSource, String toolName) throws IOException { - w.write("/* Generated by " + toolName + " on " + new Date() + "*/\r\n"); + private void writeTable(BufferedWriter w, ValueSource valueSource) throws IOException { + w.write(FINGER_PRINT); for (int loadIndex = 0; loadIndex < loadBins.getRawData().length; loadIndex++) writeTableLine(valueSource, w, loadIndex); }