From ebf334880345433e55e6f7ea9ccc7612e9a8a4a9 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Fri, 5 Sep 2014 23:02:50 -0500 Subject: [PATCH] auto-sync --- firmware/config/engines/mazda_miata.cpp | 99 ++++++++++++++++--- firmware/config/engines/mazda_miata.h | 11 +-- firmware/hw_layer/board_test.cpp | 2 + .../src/com/irnems/file/TableGenerator.java | 26 +++-- .../ui/src/com/rusefi/EcuStimulator.java | 36 +++---- .../ui/src/com/rusefi/StimulationInputs.java | 18 +++- .../ui/src/com/rusefi/ValueRangeControl.java | 6 ++ 7 files changed, 145 insertions(+), 53 deletions(-) diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index 1f27b3b500..953aa205c1 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -13,6 +13,29 @@ #include "mazda_miata.h" #include "engine_math.h" +// setFrankenso_01_LCD +#include "honda_accord.h" + +static float miata_maf_fuel_table[16][16] = { +{/*0 engineLoad=1.2*//*0 800.0*/1.53, /*1 1213.0*/0.92, /*2 1626.0*/0.74, /*3 2040.0*/0.69, /*4 2453.0*/0.69, /*5 2866.0*/0.67, /*6 3280.0*/0.67, /*7 3693.0*/0.67, /*8 4106.0*/0.67, /*9 4520.0*/1.02, /*10 4933.0*/0.98, /*11 5346.0*/0.98, /*12 5760.0*/0.92, /*13 6173.0*/0.89, /*14 6586.0*/0.82, /*15 7000.0*/0.87}, +{/*1 engineLoad=1.413333*//*0 800.0*/2.98, /*1 1213.0*/2.07, /*2 1626.0*/1.74, /*3 2040.0*/1.55, /*4 2453.0*/1.43, /*5 2866.0*/1.18, /*6 3280.0*/0.0, /*7 3693.0*/0.0, /*8 4106.0*/0.0, /*9 4520.0*/0.0, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, +{/*2 engineLoad=1.626666*//*0 800.0*/4.9, /*1 1213.0*/3.45, /*2 1626.0*/2.76, /*3 2040.0*/2.35, /*4 2453.0*/2.08, /*5 2866.0*/1.84, /*6 3280.0*/0.0, /*7 3693.0*/0.0, /*8 4106.0*/0.0, /*9 4520.0*/0.0, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, +{/*3 engineLoad=1.839999*//*0 800.0*/6.94, /*1 1213.0*/4.81, /*2 1626.0*/3.79, /*3 2040.0*/3.14, /*4 2453.0*/2.72, /*5 2866.0*/2.42, /*6 3280.0*/1.93, /*7 3693.0*/1.8, /*8 4106.0*/0.0, /*9 4520.0*/0.0, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, +{/*4 engineLoad=2.053332*//*0 800.0*/11.94, /*1 1213.0*/6.67, /*2 1626.0*/5.15, /*3 2040.0*/4.23, /*4 2453.0*/3.63, /*5 2866.0*/3.19, /*6 3280.0*/2.83, /*7 3693.0*/2.59, /*8 4106.0*/2.39, /*9 4520.0*/2.24, /*10 4933.0*/0.0, /*11 5346.0*/0.0, /*12 5760.0*/0.0, /*13 6173.0*/0.0, /*14 6586.0*/0.0, /*15 7000.0*/0.0}, +{/*5 engineLoad=2.266665*//*0 800.0*/12.63, /*1 1213.0*/10.51, /*2 1626.0*/6.91, /*3 2040.0*/5.63, /*4 2453.0*/4.8, /*5 2866.0*/4.21, /*6 3280.0*/3.75, /*7 3693.0*/3.4, /*8 4106.0*/3.09, /*9 4520.0*/2.87, /*10 4933.0*/2.8, /*11 5346.0*/2.68, /*12 5760.0*/2.52, /*13 6173.0*/2.38, /*14 6586.0*/2.29, /*15 7000.0*/0.0}, +{/*6 engineLoad=2.479998*//*0 800.0*/12.11, /*1 1213.0*/12.5, /*2 1626.0*/10.04, /*3 2040.0*/7.24, /*4 2453.0*/6.11, /*5 2866.0*/5.32, /*6 3280.0*/4.73, /*7 3693.0*/4.28, /*8 4106.0*/3.89, /*9 4520.0*/3.61, /*10 4933.0*/3.54, /*11 5346.0*/3.32, /*12 5760.0*/3.13, /*13 6173.0*/2.92, /*14 6586.0*/2.82, /*15 7000.0*/0.0}, +{/*7 engineLoad=2.693331*//*0 800.0*/12.09, /*1 1213.0*/12.19, /*2 1626.0*/12.43, /*3 2040.0*/10.69, /*4 2453.0*/7.92, /*5 2866.0*/6.87, /*6 3280.0*/6.09, /*7 3693.0*/5.49, /*8 4106.0*/4.97, /*9 4520.0*/4.59, /*10 4933.0*/4.44, /*11 5346.0*/4.21, /*12 5760.0*/3.97, /*13 6173.0*/3.7, /*14 6586.0*/3.55, /*15 7000.0*/0.0}, +{/*8 engineLoad=2.906664*//*0 800.0*/12.09, /*1 1213.0*/12.18, /*2 1626.0*/12.34, /*3 2040.0*/12.48, /*4 2453.0*/11.36, /*5 2866.0*/9.48, /*6 3280.0*/7.68, /*7 3693.0*/6.89, /*8 4106.0*/6.23, /*9 4520.0*/5.76, /*10 4933.0*/5.65, /*11 5346.0*/5.32, /*12 5760.0*/4.97, /*13 6173.0*/4.6, /*14 6586.0*/4.4, /*15 7000.0*/0.0}, +{/*9 engineLoad=3.119997*//*0 800.0*/12.08, /*1 1213.0*/12.17, /*2 1626.0*/12.34, /*3 2040.0*/12.41, /*4 2453.0*/12.76, /*5 2866.0*/12.47, /*6 3280.0*/11.02, /*7 3693.0*/9.67, /*8 4106.0*/8.29, /*9 4520.0*/7.23, /*10 4933.0*/7.0, /*11 5346.0*/6.82, /*12 5760.0*/6.44, /*13 6173.0*/6.06, /*14 6586.0*/5.76, /*15 7000.0*/0.0}, +{/*10 engineLoad=3.33333*//*0 800.0*/12.08, /*1 1213.0*/12.18, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.7, /*5 2866.0*/12.93, /*6 3280.0*/12.78, /*7 3693.0*/12.4, /*8 4106.0*/11.4, /*9 4520.0*/10.16, /*10 4933.0*/9.44, /*11 5346.0*/9.01, /*12 5760.0*/8.36, /*13 6173.0*/7.83, /*14 6586.0*/7.45, /*15 7000.0*/0.0}, +{/*11 engineLoad=3.546663*//*0 800.0*/12.09, /*1 1213.0*/12.17, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.7, /*5 2866.0*/12.89, /*6 3280.0*/12.72, /*7 3693.0*/12.55, /*8 4106.0*/12.98, /*9 4520.0*/12.96, /*10 4933.0*/12.3, /*11 5346.0*/11.59, /*12 5760.0*/10.9, /*13 6173.0*/10.07, /*14 6586.0*/9.59, /*15 7000.0*/0.0}, +{/*12 engineLoad=3.759996*//*0 800.0*/12.08, /*1 1213.0*/12.18, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.7, /*5 2866.0*/12.93, /*6 3280.0*/12.72, /*7 3693.0*/12.63, /*8 4106.0*/12.87, /*9 4520.0*/13.56, /*10 4933.0*/14.76, /*11 5346.0*/14.62, /*12 5760.0*/14.14, /*13 6173.0*/13.39, /*14 6586.0*/12.19, /*15 7000.0*/0.0}, +{/*13 engineLoad=3.973329*//*0 800.0*/12.09, /*1 1213.0*/12.17, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.71, /*5 2866.0*/12.92, /*6 3280.0*/12.74, /*7 3693.0*/12.57, /*8 4106.0*/12.88, /*9 4520.0*/13.82, /*10 4933.0*/15.15, /*11 5346.0*/15.57, /*12 5760.0*/16.22, /*13 6173.0*/16.05, /*14 6586.0*/15.59, /*15 7000.0*/0.0}, +{/*14 engineLoad=4.186662*//*0 800.0*/12.08, /*1 1213.0*/12.18, /*2 1626.0*/12.34, /*3 2040.0*/12.4, /*4 2453.0*/12.71, /*5 2866.0*/12.92, /*6 3280.0*/12.71, /*7 3693.0*/12.53, /*8 4106.0*/12.97, /*9 4520.0*/13.55, /*10 4933.0*/14.87, /*11 5346.0*/15.67, /*12 5760.0*/16.16, /*13 6173.0*/16.2, /*14 6586.0*/15.89, /*15 7000.0*/0.0}, +{/*15 engineLoad=4.399995*//*0 800.0*/12.08, /*1 1213.0*/12.17, /*2 1626.0*/12.34, /*3 2040.0*/12.43, /*4 2453.0*/12.74, /*5 2866.0*/12.91, /*6 3280.0*/12.71, /*7 3693.0*/12.54, /*8 4106.0*/12.97, /*9 4520.0*/13.53, /*10 4933.0*/14.87, /*11 5346.0*/15.48, /*12 5760.0*/16.1, /*13 6173.0*/16.18, /*14 6586.0*/15.93, /*15 7000.0*/0.0} +}; + + static void setDefaultCrankingFuel(engine_configuration_s *engineConfiguration) { // todo: set cranking parameters method based on injectors and displacement? @@ -30,6 +53,10 @@ static void commonMiataNa(engine_configuration_s *engineConfiguration, board_con engineConfiguration->triggerConfig.triggerType = TT_MAZDA_MIATA_NA; engineConfiguration->ignitionMode = IM_WASTED_SPARK; + setFuelLoadBin(engineConfiguration, 1.2, 4.4); + setFuelRpmBin(engineConfiguration, 800, 7000); + + boardConfiguration->idleSolenoidFrequency = 160; engineConfiguration->globalTriggerAngleOffset = 114; @@ -153,30 +180,80 @@ void setFordEscortGt(engine_configuration_s *engineConfiguration, board_configur } /** + * Frankenso board * set_engine_type 20 */ void setMiata1994(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { - commonMiataNa(engineConfiguration, boardConfiguration); - engineConfiguration->displacement = 1.839; - boardConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU - boardConfiguration->triggerSimulatorPins[1] = GPIOB_3; // 2E - WHT - four times - boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; - boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; + for (int k = 0; k < FUEL_LOAD_COUNT; k++) { + for (int r = 0; r < FUEL_RPM_COUNT; r++) { + engineConfiguration->fuelTable[k][r] = miata_maf_fuel_table[k][r]; + } + } - boardConfiguration->triggerInputPins[0] = GPIO_NONE; - boardConfiguration->triggerInputPins[1] = GPIO_NONE; - boardConfiguration->is_enabled_spi_1 = false; - boardConfiguration->is_enabled_spi_2 = false; - boardConfiguration->is_enabled_spi_3 = false; +// boardConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU +// boardConfiguration->triggerSimulatorPins[1] = GPIOB_3; // 2E - WHT - four times +// boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; +// boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; +// +// boardConfiguration->triggerInputPins[0] = GPIO_NONE; +// boardConfiguration->triggerInputPins[1] = GPIO_NONE; +// +// boardConfiguration->is_enabled_spi_1 = false; +// boardConfiguration->is_enabled_spi_2 = false; +// boardConfiguration->is_enabled_spi_3 = false; + + /** + * Outputs + */ + // Frankenso low out #: + // Frankenso low out #: + // Frankenso low out #: + // Frankenso low out #: + // Frankenso low out #5: PE3 + // Frankenso low out #6: PE4 + // Frankenso low out #7: PE1 (do not use with discovery!) + // Frankenso low out #: + // Frankenso low out #9: PB9 + // Frankenso low out #10: PE0 (do not use with discovery!) + // Frankenso low out #11: PB8 + // Frankenso low out #12: PB7 + + + boardConfiguration->idleValvePin = GPIOB_9; + boardConfiguration->o2heaterPin = GPIO_NONE; + + boardConfiguration->fuelPumpPin = GPIOE_4; + + boardConfiguration->injectionPins[0] = GPIOE_3; + boardConfiguration->injectionPins[1] = GPIOE_2; + boardConfiguration->injectionPins[2] = GPIOB_8; + boardConfiguration->injectionPins[3] = GPIOB_7; + + boardConfiguration->ignitionPins[0] = GPIOE_12; + boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[2] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPinMode = OM_DEFAULT; + + setFrankenso_01_LCD(boardConfiguration); } +/** + * Tom tomiata, Frankenstein board + */ void setMiata1996(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) { commonMiataNa(engineConfiguration, boardConfiguration); + engineConfiguration->displacement = 1.839; + for (int k = 0; k < FUEL_LOAD_COUNT; k++) { + for (int r = 0; r < FUEL_RPM_COUNT; r++) { + engineConfiguration->fuelTable[k][r] = miata_maf_fuel_table[k][r]; + } + } } diff --git a/firmware/config/engines/mazda_miata.h b/firmware/config/engines/mazda_miata.h index 6058696aa2..352a4f976e 100644 --- a/firmware/config/engines/mazda_miata.h +++ b/firmware/config/engines/mazda_miata.h @@ -1,6 +1,6 @@ /** - * @file ford_escort_gt.h - * @brief 1993 Ford Escort GT engine configuration. The US Escort. + * @file mazda_miata.h + * @brief Mazda Miata NA, also 1993 Ford Escort GT engine configuration. The US Escort. * * @date Oct 31, 2013 * @author Andrey Belomutskiy, (c) 2012-2014 @@ -9,15 +9,14 @@ * Injectors: Denso 195500-2180, 230-265cc (?), tan, 13.9 ohms */ -#ifndef FORD_ESCORT_GT_H_ -#define FORD_ESCORT_GT_H_ +#ifndef MAZDA_MIATA_H_ +#define MAZDA_MIATA_H_ #include "engine_configuration.h" void setFordEscortGt(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); -// todo: maybe it's time to rename this file to Miata NA? Miata? Mazda? void setMiata1990(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1994(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setMiata1996(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); -#endif /* FORD_ESCORT_GT_H_ */ +#endif /* MAZDA_MIATA_H_ */ diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp index 113098a2b8..a8788da786 100644 --- a/firmware/hw_layer/board_test.cpp +++ b/firmware/hw_layer/board_test.cpp @@ -99,6 +99,8 @@ static brain_pin_e BLINK_PINS[] = { GPIOE_8, // HIGH DRIVER 1 GPIOE_1, // OUT10 GPIOB_8, // OUT11 GPIOB_9, // OUT12 + GPIOD_7, // OUT3 Frankenso + GPIOB_7, // OUT12 Frankenso }; static THD_WORKING_AREA(btThreadStack, UTILITY_THREAD_STACK_SIZE); diff --git a/java_console/io/src/com/irnems/file/TableGenerator.java b/java_console/io/src/com/irnems/file/TableGenerator.java index 914dc97ef6..2652e507e5 100644 --- a/java_console/io/src/com/irnems/file/TableGenerator.java +++ b/java_console/io/src/com/irnems/file/TableGenerator.java @@ -8,7 +8,6 @@ import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Set; /** * @author Andrey Belomutskiy @@ -31,36 +30,35 @@ public class TableGenerator { } private static void doWrite(XYData data, String prefix, String fileName) throws IOException { - List rpms = new ArrayList(data.getXSet()); + List rpms = new ArrayList<>(data.getXSet()); BufferedWriter out = new BufferedWriter(new FileWriter(fileName)); out.write("#include \"thermistors.h\"\n\n\n"); - writeArray(rpms, out, prefix + "rpm"); +// writeArray(rpms, out, prefix + "rpm"); - Set mafs = data.getYAxis(rpms.get(0)).getYs(); - ArrayList yArray = new ArrayList(mafs); - writeArray(yArray, out, prefix + "maf"); + List engineLoadValues = new ArrayList<>(data.getYAxis(rpms.get(0)).getYs()); +// writeArray(yArray, out, prefix + "maf"); - out.write("static float " + prefix + "table[" + rpms.size() + "][" + mafs.size() + "] = {\n"); + out.write("static float " + prefix + "table[" + rpms.size() + "][" + engineLoadValues.size() + "] = {\n"); - boolean isFirstX = true; + boolean isFirstEngineLoad = true; int indexX = 0; - for (double x : data.getXSet()) { - if (!isFirstX) + for (double engineLoad : engineLoadValues) { + if (!isFirstEngineLoad) out.write(",\n"); - isFirstX = false; + isFirstEngineLoad = false; out.write("{"); int indexY = 0; - for (double y : mafs) { + for (double rpm : data.getXSet()) { if (indexY == 0) - out.write("/*" + indexX + " rpm=" + rpms.get(indexX) + "*/"); + out.write("/*" + indexX + " engineLoad=" + engineLoadValues.get(indexX) + "*/"); if (indexY > 0) out.write(", "); - out.write("/*" + indexY + " " + yArray.get(indexY) + "*/" + data.getValue(x, y)); + out.write("/*" + indexY + " " + rpms.get(indexY) + "*/" + data.getValue(rpm, engineLoad)); indexY++; } out.write("}"); diff --git a/java_console/ui/src/com/rusefi/EcuStimulator.java b/java_console/ui/src/com/rusefi/EcuStimulator.java index 3377a9fff5..415b81a22d 100644 --- a/java_console/ui/src/com/rusefi/EcuStimulator.java +++ b/java_console/ui/src/com/rusefi/EcuStimulator.java @@ -39,24 +39,21 @@ public class EcuStimulator { private static final String DELIMITER = ","; private static final long SLEEP_TIME = 300; + private static final double EPS = 0.001; - private static final double EL_INCREMENT = 0.1; + public boolean isDisplayingDwell = true; - private static final int RPM_MIN = 400; - private static final int RPM_MAX = 6000; - private static final int RPM_INCREMENT = 250; - private static final Sensor DWELL_SENSOR = Sensor.DWELL0; - public static final Sensor ADVANCE_SENSOR = Sensor.ADVANCE0; - private static final String CSV_FILE_NAME = "table" + RPM_INCREMENT + "_" + EL_INCREMENT + ".csv"; + private static final Sensor DWELL_SENSOR = Sensor.DWELL1; + public static final Sensor ADVANCE_SENSOR = Sensor.ADVANCE1; private static final int MEASURES = 7; // private static final String C_FILE_NAME = "advance_map.c"; // private static final String C_PREFIX = "ad_"; - private static final String C_FILE_NAME = "fuel_map.c"; + private static final String C_PREFIX = "fuel_"; - public static Range RPM_RANGE = new Range(0, RPM_MAX); // x-coord + public static Range RPM_RANGE = new Range(0, StimulationInputs.DEFAULT_RPM_MAX); // x-coord private StimulationInputs inputs = new StimulationInputs(this); // private XYData data = new XYData(); @@ -90,17 +87,20 @@ public class EcuStimulator { // if (1 == 1) // return; + String csvFileName = "table_" + inputs.getRpmStep() + "_" + inputs.getEngineLoadStep() + FileLog.getDate() + ".csv"; + FileLog.MAIN.logLine("Wring to " + csvFileName); + final BufferedWriter csv; try { - csv = new BufferedWriter(new FileWriter(CSV_FILE_NAME)); + csv = new BufferedWriter(new FileWriter(csvFileName)); } catch (IOException e) { throw new IllegalStateException(e); } ResultListener listener = new ResultListener() { @Override - public void onResult(int rpm, double engineLoad, float advance, double dwell) { - data.addPoint(new Point3D(rpm, engineLoad, (float) advance)); + public void onResult(int rpm, double engineLoad, double advance, double dwell) { + data.addPoint(new Point3D(rpm, engineLoad, isDisplayingDwell ? (float) dwell : (float) advance)); model.plot().execute(); String msg = putValue("rpm", rpm) + @@ -128,14 +128,14 @@ public class EcuStimulator { throw new IllegalStateException(e); } - TableGenerator.writeAsC(data, C_PREFIX, C_FILE_NAME); + TableGenerator.writeAsC(data, C_PREFIX, "map" + FileLog.getDate() + ".c"); } private void buildTable(ResultListener listener, Sensor dwellSensor) { - for (int rpm = inputs.getRpmFrom(); rpm <= inputs.getRpmTo(); rpm += RPM_INCREMENT) { - for (double engineLoad = inputs.getEngineLoadMin(); engineLoad <= inputs.getEngineLoadMax(); engineLoad += EL_INCREMENT) { + for (double rpm = inputs.getRpmFrom(); rpm <= inputs.getRpmTo() + EPS; rpm += inputs.getRpmStep()) { + for (double engineLoad = inputs.getEngineLoadMin(); engineLoad <= inputs.getEngineLoadMax() + EPS; engineLoad += inputs.getEngineLoadStep()) { for (int clt = inputs.getCltFrom(); clt <= inputs.getCltTo(); clt += 100) { - testPoint(rpm, engineLoad, clt, listener, dwellSensor); + testPoint((int) rpm, engineLoad, clt, listener, dwellSensor); } } } @@ -173,7 +173,7 @@ public class EcuStimulator { // if (dwell > 40) // throw new IllegalStateException("Unexpected value, how comes? " + dwell); - log("Stimulator result: " + rpm + "@" + engineLoad + ": " + dwell); + log("Stimulator result: " + rpm + "@" + engineLoad + ": " + dwell + ", adv=" + advance); // double dwell = Launcher.getAdcModel().getValue(Sensor.DWELL0); // double advance = Launcher.getAdcModel().getValue(Sensor.ADVANCE); @@ -283,7 +283,7 @@ public class EcuStimulator { } interface ResultListener { - void onResult(int rpm, double engineLoad, float advance, double dwell); + void onResult(int rpm, double engineLoad, double advance, double dwell); } public MultipleMeasurements waitForMultipleResults(final Sensor dwellSensor, final Sensor advanceSensor) { diff --git a/java_console/ui/src/com/rusefi/StimulationInputs.java b/java_console/ui/src/com/rusefi/StimulationInputs.java index e200a49b3a..66a83cfa0f 100644 --- a/java_console/ui/src/com/rusefi/StimulationInputs.java +++ b/java_console/ui/src/com/rusefi/StimulationInputs.java @@ -10,12 +10,14 @@ import java.awt.*; * (c) Andrey Belomutskiy */ public class StimulationInputs { + static final int DEFAULT_RPM_MIN = 800; + static final int DEFAULT_RPM_MAX = 7000; private final JPanel content = new JPanel(new GridLayout(7, 1)); private final JSpinner elResistance2 = new JSpinner(new SpinnerNumberModel(10000, 0, 100000, 1)); - private final ValueRangeControl elRange = new ValueRangeControl("engine load", 1, 0.1, 4.6); + private final ValueRangeControl elRange = new ValueRangeControl("engine load", 1.2, 0.213333, 4.4); - private final ValueRangeControl rpmRange = new ValueRangeControl("RPM", 400, 100, 6000); + private final ValueRangeControl rpmRange = new ValueRangeControl("RPM", DEFAULT_RPM_MIN, 413.333374, DEFAULT_RPM_MAX); private final ValueRangeControl cltRange = new ValueRangeControl("CLR r", 100, 100, 100); private final ValueRangeControl iatRange = new ValueRangeControl("IAT r", 100, 100, 9900); private final ValueRangeControl tpsRange = new ValueRangeControl("TPS", 1, 0.1, 4.5); @@ -49,14 +51,18 @@ public class StimulationInputs { return elRange.getTo(); } - public int getRpmFrom() { + public double getRpmFrom() { return (int) rpmRange.getFrom(); } - public int getRpmTo() { + public double getRpmTo() { return (int) rpmRange.getTo(); } + public double getRpmStep() { + return rpmRange.getStep(); + } + public int getCltFrom() { return (int) cltRange.getFrom(); } @@ -78,5 +84,9 @@ public class StimulationInputs { public double getEngineLoadR2Resistance() { return (Integer) elResistance2.getValue(); } + + public double getEngineLoadStep() { + return elRange.getStep(); + } } diff --git a/java_console/ui/src/com/rusefi/ValueRangeControl.java b/java_console/ui/src/com/rusefi/ValueRangeControl.java index 3c9495f767..f6366e5067 100644 --- a/java_console/ui/src/com/rusefi/ValueRangeControl.java +++ b/java_console/ui/src/com/rusefi/ValueRangeControl.java @@ -8,9 +8,11 @@ public class ValueRangeControl { private final JSpinner maxSpinner; private final JPanel panel = new JPanel(new FlowLayout()); + private final double increment; public ValueRangeControl(String title, double min, double increment, double max) { + this.increment = increment; minSpinner = new JSpinner(new SpinnerNumberModel(min, min, max, increment)); maxSpinner = new JSpinner(new SpinnerNumberModel(max, min, max, increment)); @@ -28,6 +30,10 @@ public class ValueRangeControl { return (double) maxSpinner.getModel().getValue(); } + public double getStep() { + return increment; + } + public Component getContent() { return panel; }