From f59fb7a9a034ea13181f52cafb112c96b19c6a00 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 2 Feb 2015 22:07:37 -0600 Subject: [PATCH] auto-sync --- firmware/config/engines/custom_engine.cpp | 2 +- .../engine_configuration_generated_structures.h | 12 +++++++----- firmware/controllers/trigger/trigger_decoder.cpp | 16 ++++++++++++++++ firmware/rusefi_config.ini | 6 +++--- firmware/tunerstudio/rusefi.ini | 7 ++++--- unit_tests/test_trigger_decoder.cpp | 3 +++ 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index 922ec2aef3..8bf759af1f 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -11,7 +11,7 @@ #include "honda_accord.h" void setCustomEngineConfiguration(engine_configuration_s *engineConfiguration) { -// engineConfiguration->trigger.type = + engineConfiguration->trigger.type = TT_ONE_PLUS_ONE; board_configuration_s * boardConfiguration = &engineConfiguration->bc; setFrankenso_01_LCD(boardConfiguration); diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index 30b4c106a8..d1263ad2dc 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated by config_definition.jar on Mon Feb 02 11:59:15 EST 2015 +// this section was generated by config_definition.jar on Mon Feb 02 22:40:26 EST 2015 // begin #include "rusefi_types.h" typedef struct { @@ -165,9 +165,11 @@ typedef struct { */ trigger_type_e type; /** - * offset 4 - */ - bool32_t customIsSynchronizationNeeded; + offset 4 bit 0 */ + bool_t customIsSynchronizationNeeded : 1; + /** + offset 4 bit 1 */ + bool_t customUseSecondChannel : 1; /** * offset 8 */ @@ -1128,4 +1130,4 @@ typedef struct { } engine_configuration_s; // end -// this section was generated by config_definition.jar on Mon Feb 02 11:59:15 EST 2015 +// this section was generated by config_definition.jar on Mon Feb 02 22:40:26 EST 2015 diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 65fac9409b..a3ed08a864 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -255,6 +255,18 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, initializeSkippedToothTriggerShape(s, totalTeethCount, skippedCount, operationMode); } +static void configureOnePlusOne(TriggerShape *s) { + s->reset(FOUR_STROKE_CAM_SENSOR); + + s->addEvent(180, T_PRIMARY, TV_HIGH); + s->addEvent(360, T_PRIMARY, TV_LOW); + + s->addEvent(540, T_SECONDARY, TV_HIGH); + s->addEvent(720, T_SECONDARY, TV_LOW); + + s->isSynchronizationNeeded = false; +} + /** * External logger is needed because at this point our logger is not yet initialized */ @@ -307,6 +319,10 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin configureMazdaProtegeLx(triggerShape); break; + case TT_ONE_PLUS_ONE: + configureOnePlusOne(triggerShape); + break; + case TT_MAZDA_SOHC_4: configureMazdaProtegeSOHC(triggerShape); break; diff --git a/firmware/rusefi_config.ini b/firmware/rusefi_config.ini index b3a93ab2ec..06ede864d4 100644 --- a/firmware/rusefi_config.ini +++ b/firmware/rusefi_config.ini @@ -1,7 +1,6 @@ ! this file defines the format of rusEfi persistent configuration structure ! this file is processed by ../java_tools/config_definition.jar tool -! ! comments start with '!' ! ! each field is declared as @@ -213,10 +212,11 @@ struct trigger_config_s @brief Trigger wheel(s) configuration custom bool32_t 4 bits, U32, @OFFSET@, [0:0], "false", "true" -custom trigger_type_e 4 bits, U32, @OFFSET@, [0:3], "custom toothed wheel", "ford aspire", "dodge neon", "Miata NA", "Miata NB", "GM_7X", "Cooper", "Escort GT", "60/2", "36/1", "Accord CD", "MITSU", "INVALID", "INVALID", "INVALID", "INVALID" +custom trigger_type_e 4 bits, U32, @OFFSET@, [0:4], "custom toothed wheel", "ford aspire", "dodge neon", "Miata NA", "Miata NB", "GM_7X", "Cooper", "Mazda SOHC 4", "60/2", "36/1", "Accord CD", "MITSU", "ACCORD 2", "ACCORD DIP", "Neon 2003", "MAZDA D 4+1", "1+1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" trigger_type_e type; - bool32_t customIsSynchronizationNeeded; + bit customIsSynchronizationNeeded; + bit customUseSecondChannel; int customTotalToothCount;;"number", 1, 0.0, 0, 1000.0, 2 int customSkippedToothCount;;"number", 1, 0.0, 0, 1000.0, 2 diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 168958d820..818038c55e 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -37,7 +37,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated by ConfigDefinition.jar on Mon Feb 02 11:59:15 EST 2015 +; this section was generated by ConfigDefinition.jar on Mon Feb 02 22:40:27 EST 2015 pageSize = 11832 page = 1 @@ -126,8 +126,9 @@ page = 1 tpsAdcChannel = bits, U32, 1016, [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5" ;skipping overrideCrankingIgnition offset 1020 analogChartFrequency = scalar, S32, 1024, "index", 1, 0, 0, 300, 0 ; size 4 - trigger_type = bits, U32, 1028, [0:3], "custom toothed wheel", "ford aspire", "dodge neon", "Miata NA", "Miata NB", "GM_7X", "Cooper", "Escort GT", "60/2", "36/1", "Accord CD", "MITSU", "INVALID", "INVALID", "INVALID", "INVALID" - trigger_customIsSynchronizationNeeded = bits, U32, 1032, [0:0], "false", "true" + trigger_type = bits, U32, 1028, [0:4], "custom toothed wheel", "ford aspire", "dodge neon", "Miata NA", "Miata NB", "GM_7X", "Cooper", "Mazda SOHC 4", "60/2", "36/1", "Accord CD", "MITSU", "ACCORD 2", "ACCORD DIP", "Neon 2003", "MAZDA D 4+1", "1+1", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + trigger_customIsSynchronizationNeeded= bits, U32, 1032, [0:0], "false", "true" + trigger_customUseSecondChannel= bits, U32, 1032, [1:1], "false", "true" trigger_customTotalToothCount = scalar, S32, 1036, "number", 1, 0.0, 0, 1000.0, 2 trigger_customSkippedToothCount = scalar, S32, 1040, "number", 1, 0.0, 0, 1000.0, 2 trigger_customSyncRatioFrom = scalar, F32, 1044, "number", 1, 0.0, 0, 1000.0, 2 diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index f9d064eca2..db8176a481 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -521,6 +521,9 @@ void testTriggerDecoder(void) { testTriggerDecoder2("testFordEscortGt", FORD_ESCORT_GT, 0, 0.8096, 0.3844); testTriggerDecoder2("testMiniCooper", MINI_COOPER_R50, 121, 0.5222, 0.4959); testTriggerDecoder2("testRoverV8", ROVER_V8, 0, 0.4861, 0); + + testTriggerDecoder2("test1+1", CUSTOM_ENGINE, 0, 0.7500, 0.2500); + testTriggerDecoder2("testCitroen", CITROEN_TU3JP, 0, 0.4833, 0); testTriggerDecoder2("testAccordCd 3w", HONDA_ACCORD_CD, 12, 0.8146, 0.5000); testTriggerDecoder2("testAccordCd 2w", HONDA_ACCORD_CD_TWO_WIRES, 10, 0.8146, 0.5);