In the code i can see my values , and i feel in control.
Maybe someone can help me by checking whether i do it the right way.
As overview, these files i changed in the firmware dir:(see below)
I excluded the fish files that are simple conversions of the *.bat files to my shell. (fish shell) .
I excluded the autogenerated.
after the code stuff i describe in what order i did things.
cmds and output:
Code: Select all
➤ git log --oneline origin/master^..origin/master #means my origin/master is at 33e...
33e87ba69 (origin/master) Merge branch 'master' of https://github.com/rusefi/rusefi
153aae2fc docs
if i load the engine with set engine_type 57 ,then the name shows up , but the values that get loaded are wrong . no ign pin , wrong fuel inj mode,etc..
Code: Select all
➤ git diff --stat=300 origin/master firmware|grep -v '.fish'|grep -v 'generated'|grep -v firmware/tunerstudio/rusefi.ini
firmware/.gitignore | 7 +-
firmware/config/engines/engines.mk | 5 +-
firmware/config/engines/mazda_z5.cpp | 75 ++++++
firmware/config/engines/mazda_z5.h | 21 ++
firmware/controllers/algo/engine_configuration.cpp | 1 +
firmware/controllers/algo/rusefi_enums.h | 6 +-
firmware/controllers/trigger/decoders/trigger_mazda.cpp | 41 +++
firmware/controllers/trigger/decoders/trigger_mazda.h | 1 +
firmware/controllers/trigger/trigger_decoder.cpp | 4 +
35 files changed, 353 insertions(+), 6504 deletions(-)
i added the engine file to compile:
Code: Select all
diff --git a/firmware/config/engines/engines.mk b/firmware/config/engines/engines.mk
index 971c4af21..2ade3a6bb 100644
--- a/firmware/config/engines/engines.mk
+++ b/firmware/config/engines/engines.mk
@@ -44,3 +44,4 @@ ENGINES_SRC_CPP = $(PROJECT_DIR)/config/engines/ford_aspire.cpp \
$(PROJECT_DIR)/config/engines/honda_600.cpp \
- $(PROJECT_DIR)/config/engines/ford_festiva.cpp
-
\ No newline at end of file
+ $(PROJECT_DIR)/config/engines/ford_festiva.cpp \
+ $(PROJECT_DIR)/config/engines/mazda_z5.cpp
+
Code: Select all
diff --git a/firmware/config/engines/mazda_z5.cpp b/firmware/config/engines/mazda_z5.cpp
new file mode 100644
index 000000000..f273c4ce8
--- /dev/null
+++ b/firmware/config/engines/mazda_z5.cpp
@@ -0,0 +1,75 @@
+/**
+ * @file mazda_z5.cpp
+ *
+ * @date Nov 16, 2018
+ * @author Andrey Belomutskiy, (c) 2012-2018
+ * @author Alexander Wilhelmi, (c) 2018
+ */
+
+#include "mazda_z5.h"
+#include "settings.h"
+#include "allsensors.h"
+#include "engine_math.h"
+#include "rusefi_enums.h"
+
+void setMazda_z5_EngineConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
+
+ // Basic Setup
+ setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
+ engineConfiguration->engineType = MAZDA_Z5;
+ engineConfiguration->specs.cylindersCount = 4;
+ engineConfiguration->specs.displacement = 1.5;
+ engineConfiguration->specs.firingOrder = FO_1_3_4_2;
+ engineConfiguration->rpmHardLimit = 6500;
+
+ // Trigger
+ engineConfiguration->trigger.type = TT_MAZDA_Z5;
+
+
+ // Ignition
+ engineConfiguration->ignitionMode = IM_ONE_COIL;
+
+
+ // Fuel
+ engineConfiguration->fuelAlgorithm = LM_PLAIN_MAF;
+ engineConfiguration->injector.flow = 180;
+ engineConfiguration->cranking.baseFuel = 2.5;
+
+
+ // stock sensors parameters
+ engineConfiguration->tpsMin = 80;
+ engineConfiguration->tpsMax = 764;
+ setCommonNTCSensor(&engineConfiguration->iat);
+ setThermistorConfiguration(&engineConfiguration->iat, -10, 30000, 9, 4000, 80, 240);
+ setCommonNTCSensor(&engineConfiguration->clt);
+ setThermistorConfiguration(&engineConfiguration->clt, -20, 20000, 20, 2400, 80, 600);
+
+
+ // boardconfig
+ engineConfiguration->clt.config.bias_resistor = 3300;
+ engineConfiguration->iat.config.bias_resistor = 3300;
+ boardConfiguration->ignitionPinMode = OM_INVERTED;
+
+ //wiring
+ boardConfiguration->triggerInputPins[0] = GPIOA_5;
+ boardConfiguration->triggerInputPins[1] = GPIOC_6;
+ engineConfiguration->tpsAdcChannel = EFI_ADC_5;
+ engineConfiguration->mafAdcChannel = EFI_ADC_3;
+ engineConfiguration->clt.adcChannel = EFI_ADC_1;
+ engineConfiguration->iat.adcChannel = EFI_ADC_2;
+ boardConfiguration->ignitionPins[0] = GPIOE_6;
+ boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
+ boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
+ boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
+ boardConfiguration->injectionPins[0] = GPIOB_9;
+ boardConfiguration->injectionPins[1] = GPIOD_5;
+ boardConfiguration->injectionPins[2] = GPIOB_8;
+ boardConfiguration->injectionPins[3] = GPIOB_7;
+ boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
+ boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
+ boardConfiguration->fanPin = GPIOE_6;
+ boardConfiguration->o2heaterPin = GPIOC_3;
+ boardConfiguration->fuelPumpPin = GPIOC_13;
+ boardConfiguration->idle.solenoidPin = GPIOE_4;
+ engineConfiguration->brakePedalPin = GPIOA_7;
+}
Code: Select all
diff --git a/firmware/config/engines/mazda_z5.h b/firmware/config/engines/mazda_z5.h
new file mode 100644
index 000000000..8e3d9f300
--- /dev/null
+++ b/firmware/config/engines/mazda_z5.h
@@ -0,0 +1,21 @@
+/**
+ * @file mazda_z5.h
+ *
+ * 94-2000 Mazda 323 (1.5l DOHC)
+ *
+ * https://rusefi.com/forum/viewtopic.php?f=3&t=1441
+ *
+ *
+ * @date Nov 16, 2018
+ * @author Andrey Belomutskiy, (c) 2012-2017
+ * @author Alexander Wilhelmi, (c) 2018
+ */
+
+#ifndef MAZDA_Z5_H_
+#define MAZDA_Z5_H_
+
+#include "engine.h"
+
+void setMazda_z5_EngineConfiguration(engine_configuration_s *engineConfiguration);
+
+#endif /* MAZDA_Z5_H_ */
Code: Select all
diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp
index 32c983ebb..e3886955d 100644
--- a/firmware/controllers/algo/engine_configuration.cpp
+++ b/firmware/controllers/algo/engine_configuration.cpp
@@ -61,2 +61,3 @@
#include "mazda_626.h"
+#include "mazda_z5.h"
need enums for engine and trigger type
Code: Select all
diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h
index 3804ed1e2..ed5e2ba80 100644
--- a/firmware/controllers/algo/rusefi_enums.h
+++ b/firmware/controllers/algo/rusefi_enums.h
@@ -177,2 +177,4 @@ typedef enum {
+ MAZDA_Z5 = 57,
+
PROMETHEUS_DEFAULTS = 100,
@@ -290,3 +292,5 @@ typedef enum {
- TT_UNUSED = 42, // this is used if we want to iterate over all trigger types
+ TT_MAZDA_Z5 = 42,
+
+ TT_UNUSED = 43, // this is used if we want to iterate over all trigger types
TriggerShape header file had nice doc in it.
If i enable this trigger with
Code: Select all
set trigger_type 42
Code: Select all
diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp
index f5b79639f..4c7550211 100644
--- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp
+++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp
@@ -51,2 +51,43 @@ void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX
}
+void initialize_Mazda_Engine_z5_Shape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
+ s->initialize(FOUR_STROKE_CAM_SENSOR, true);
+ /**
+ * My Signal is: 60, 60, 102, 60
+ * 120, 120, 120, 78,
+ * ^
+ * |
+ * sync point = 0 degree from now on
+ * All rising edges are 60 befor some OT.
+ * If the edge goes high, it should look at the last past 2 events. (high-low-now)
+ * time1/time2 == 78/102 = 13/17 then triggerevent '0' would be nice.
+ *
+ */
+ s->useRiseEdge = true;
+ s->gapBothDirections = true;
+ s->useOnlyPrimaryForSync = true;
+ /*
+ * 60 or 420
+ */
+ s->tdcPosition = 60;
+ s->setTriggerSynchronizationGap(0.9); // because the gab is 0.9 shorter than the others befor rising edge
+ s->setSecondTriggerSynchronizationGap(1.1); // because the gab is 1.1 longer than the others befor falling edge
+
+ s->isSynchronizationNeeded = true; // would not explode if not
+ s->invertOnAdd = false;
+ /**
+ * Total count of shaft events per CAM or CRANK shaft revolution.
+ */
+ s->size = 8;
+ s->addEvent2(60.0f, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
+ s->addEvent2(180.0f, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
+
+ s->addEvent2(240.0f, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
+ s->addEvent2(360.0f, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
+
+ s->addEvent2(420.0f, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
+ s->addEvent2(540.0f, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
+
+ s->addEvent2(618.0f, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
+ s->addEvent2(720.0f, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
+}
Code: Select all
diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.h b/firmware/controllers/trigger/decoders/trigger_mazda.h
index d1423f439..786329242 100644
--- a/firmware/controllers/trigger/decoders/trigger_mazda.h
+++ b/firmware/controllers/trigger/decoders/trigger_mazda.h
@@ -21,2 +21,3 @@ void configureMazdaProtegeSOHC(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
void configureMazdaProtegeLx(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
+void initialize_Mazda_Engine_z5_Shape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX);
and here some decoder adding
Code: Select all
diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp
index 75bbb9e1b..c59526f57 100644
--- a/firmware/controllers/trigger/trigger_decoder.cpp
+++ b/firmware/controllers/trigger/trigger_decoder.cpp
@@ -497,2 +497,6 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
+ case TT_MAZDA_Z5:
+ initialize_Mazda_Engine_z5_Shape(this PASS_ENGINE_PARAMETER_SUFFIX);
+ break;
+
case TT_MIATA_VVT:
Code: Select all
➤ git diff --stat origin/master java_console |grep -v '.fish'|grep -v '.gitignore'
java_console/build.xml | 8 +-
java_console/io/src/com/rusefi/TsPageSize.java | 5 +
java_console/legal/rusefi_console_legal.txt | 5 -
java_console/lib/jlatexmath-1.0.3.jar | Bin 0 -> 1014482 bytes
.../models/src/com/rusefi/config/Fields.java | 1920 --------------------
java_console/rusefi.xml | 240 ---
7 files changed, 12 insertions(+), 2170 deletions(-)
Here the change for java console build.xml ... i think this is not the right solution
Code: Select all
diff --git a/java_console/build.xml b/java_console/build.xml
index 0dbc78f74..90300de6e 100644
--- a/java_console/build.xml
+++ b/java_console/build.xml
@@ -20,10 +20,10 @@
<src path="tools/src"/>
</javac>
- <junit fork="no"
- maxmemory="512m"
+ <junit fork="yes"
+ maxmemory="4G"
printsummary="yes"
- haltonfailure="yes">
+ haltonfailure="no">
<jvmarg value="-ea"/>
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError"/>
@@ -102,4 +102,4 @@
</copy>
</target>
-</project>
\ No newline at end of file
+</project>
- git status # my master is clean
- git log #check if origin is update
- git diff --stat=300 origin/master java_console firmware |grep -v '.fish'|grep -v 'generated'|grep -v firmware/tunerstudio/rusefi.ini|grep -v java_console/io/src/com/rusefi/TsPageSize.java ## check what in my branch diffs from origin, excluding autogen stuff.
- enter firmware dir
- export "PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:/usr/bin:/bin:/usr/sbin:/sbin/";make clean;./gen_enum_to_string.bat.fish;./gen_config.bat.fish;make -j16
- st-flash (texane version) some params ... flash verify ok , blue led on and flashing. Cool thing! it compiles. I get high from this
- enter java console dir
- ant
- java -jar ../java_console_binary/rusefi_console.jar