From 4a23e294172bc06bb73e91c4ef9fbcea997f066a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 10 Oct 2015 16:01:25 -0400 Subject: [PATCH] auto-sync --- .../controllers/trigger/trigger_chrysler.cpp | 8 +++--- .../controllers/trigger/trigger_chrysler.h | 8 +++--- .../controllers/trigger/trigger_decoder.cpp | 16 +++++------ .../controllers/trigger/trigger_mazda.cpp | 28 +++++++++---------- firmware/controllers/trigger/trigger_mazda.h | 8 +++--- .../controllers/trigger/trigger_structure.cpp | 4 +++ .../controllers/trigger/trigger_structure.h | 1 + 7 files changed, 39 insertions(+), 34 deletions(-) diff --git a/firmware/controllers/trigger/trigger_chrysler.cpp b/firmware/controllers/trigger/trigger_chrysler.cpp index 6203ead55a..9f3b1ef3ae 100644 --- a/firmware/controllers/trigger/trigger_chrysler.cpp +++ b/firmware/controllers/trigger/trigger_chrysler.cpp @@ -8,7 +8,7 @@ #include "trigger_chrysler.h" #include "trigger_decoder.h" -void initDodgeRam(TriggerShape *s) { +void initDodgeRam(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { s->reset(FOUR_STROKE_CAM_SENSOR, true); s->useRiseEdge = true; @@ -25,7 +25,7 @@ void initDodgeRam(TriggerShape *s) { s->addEvent(720, T_PRIMARY, TV_LOW); } -void configureNeon2003TriggerShape(TriggerShape *s) { +void configureNeon2003TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { bool_t useOnlyPrimary = false; s->reset(FOUR_STROKE_CAM_SENSOR, !useOnlyPrimary); @@ -236,7 +236,7 @@ void configureNeon2003TriggerShape(TriggerShape *s) { } } -void configureDodgeStratusTriggerShape(TriggerShape *s) { +void configureDodgeStratusTriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { s->reset(FOUR_STROKE_CAM_SENSOR, false); s->isSynchronizationNeeded = true; @@ -302,7 +302,7 @@ void configureDodgeStratusTriggerShape(TriggerShape *s) { s->addEvent(angle + w, T_PRIMARY, TV_LOW); } -void configureNeon1995TriggerShape(TriggerShape *s) { +void configureNeon1995TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { s->reset(FOUR_STROKE_CAM_SENSOR, true); s->setTriggerSynchronizationGap(0.72); diff --git a/firmware/controllers/trigger/trigger_chrysler.h b/firmware/controllers/trigger/trigger_chrysler.h index dc516e2493..31e8457c60 100644 --- a/firmware/controllers/trigger/trigger_chrysler.h +++ b/firmware/controllers/trigger/trigger_chrysler.h @@ -13,10 +13,10 @@ #define CHRYSLER_NGC4_GAP 1 #define CHRYSLER_NGC6_GAP 1.5 -void configureNeon1995TriggerShape(TriggerShape *s); -void configureNeon2003TriggerShape(TriggerShape *s); -void initDodgeRam(TriggerShape *s); +void configureNeon1995TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); +void configureNeon2003TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); +void initDodgeRam(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); -void configureDodgeStratusTriggerShape(TriggerShape *s); +void configureDodgeStratusTriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); #endif /* TRIGGER_CHRYSLER_H_ */ diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 937d66e154..e55a9da466 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -414,23 +414,23 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET break; case TT_MAZDA_MIATA_NA: - initializeMazdaMiataNaShape(triggerShape); + initializeMazdaMiataNaShape(triggerShape PASS_ENGINE_PARAMETER); break; case TT_MAZDA_MIATA_NB: - initializeMazdaMiataNbShape(triggerShape); + initializeMazdaMiataNbShape(triggerShape PASS_ENGINE_PARAMETER); break; case TT_DODGE_NEON_1995: - configureNeon1995TriggerShape(triggerShape); + configureNeon1995TriggerShape(triggerShape PASS_ENGINE_PARAMETER); break; case TT_DODGE_STRATUS: - configureDodgeStratusTriggerShape(triggerShape); + configureDodgeStratusTriggerShape(triggerShape PASS_ENGINE_PARAMETER); break; case TT_DODGE_NEON_2003: - configureNeon2003TriggerShape(triggerShape); + configureNeon2003TriggerShape(triggerShape PASS_ENGINE_PARAMETER); break; case TT_FORD_ASPIRE: @@ -443,7 +443,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET break; case TT_MAZDA_DOHC_1_4: - configureMazdaProtegeLx(triggerShape); + configureMazdaProtegeLx(triggerShape PASS_ENGINE_PARAMETER); break; case TT_ONE_PLUS_ONE: @@ -459,7 +459,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET break; case TT_MAZDA_SOHC_4: - configureMazdaProtegeSOHC(triggerShape); + configureMazdaProtegeSOHC(triggerShape PASS_ENGINE_PARAMETER); break; case TT_MINI_COOPER_R50: @@ -499,7 +499,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET break; case TT_DODGE_RAM: - initDodgeRam(triggerShape); + initDodgeRam(triggerShape PASS_ENGINE_PARAMETER); break; case TT_36_2_2_2: diff --git a/firmware/controllers/trigger/trigger_mazda.cpp b/firmware/controllers/trigger/trigger_mazda.cpp index 50d9facdba..cc3e34e9f4 100644 --- a/firmware/controllers/trigger/trigger_mazda.cpp +++ b/firmware/controllers/trigger/trigger_mazda.cpp @@ -20,7 +20,7 @@ #include "trigger_mazda.h" -void initializeMazdaMiataNaShape(TriggerShape *s) { +void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { s->reset(FOUR_STROKE_CAM_SENSOR, true); s->setTriggerSynchronizationGap(MIATA_NA_GAP); s->useRiseEdge = false; @@ -47,7 +47,7 @@ void initializeMazdaMiataNaShape(TriggerShape *s) { s->addEvent(720.0f, T_PRIMARY, TV_LOW); } -void initializeMazdaMiataNbShape(TriggerShape *s) { +void initializeMazdaMiataNbShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { s->setTriggerSynchronizationGap(0.11f); s->useRiseEdge = false; @@ -86,7 +86,7 @@ void initializeMazdaMiataNbShape(TriggerShape *s) { s->addEvent(720.0f, T_PRIMARY, TV_LOW); } -void configureMazdaProtegeSOHC(TriggerShape *s) { +void configureMazdaProtegeSOHC(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { // todo: move to into configuration definition s->needSecondTriggerInput = FALSE; @@ -114,28 +114,28 @@ void configureMazdaProtegeSOHC(TriggerShape *s) { s->isSynchronizationNeeded = false; } -void configureMazdaProtegeLx(TriggerShape *s) { +void configureMazdaProtegeLx(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) { // todo: move to into configuration definition s->needSecondTriggerInput = FALSE; s->reset(FOUR_STROKE_CAM_SENSOR, true); /** * based on https://svn.code.sf.net/p/rusefi/code/trunk/misc/logs/1993_escort_gt/MAIN_rfi_report_2015-02-01%2017_39.csv */ - s->addEvent(95.329254, T_PRIMARY, TV_HIGH); + s->addEvent2(95.329254, T_PRIMARY, TV_HIGH PASS_ENGINE_PARAMETER); - s->addEvent(95.329254 + 14.876692, T_SECONDARY, TV_HIGH); - s->addEvent(95.329254 + 82.693557, T_SECONDARY, TV_LOW); + s->addEvent2(95.329254 + 14.876692, T_SECONDARY, TV_HIGH PASS_ENGINE_PARAMETER); + s->addEvent2(95.329254 + 82.693557, T_SECONDARY, TV_LOW PASS_ENGINE_PARAMETER); - s->addEvent(95.329254 + 137.119154, T_PRIMARY, TV_LOW); + s->addEvent2(95.329254 + 137.119154, T_PRIMARY, TV_LOW PASS_ENGINE_PARAMETER); - s->addEvent(95.329254 + 192.378308, T_SECONDARY, TV_HIGH); - s->addEvent(95.329254 + 261.556418, T_SECONDARY, TV_LOW); + s->addEvent2(95.329254 + 192.378308, T_SECONDARY, TV_HIGH PASS_ENGINE_PARAMETER); + s->addEvent2(95.329254 + 261.556418, T_SECONDARY, TV_LOW PASS_ENGINE_PARAMETER); - s->addEvent(95.329254 + 373.060597, T_SECONDARY, TV_HIGH); - s->addEvent(95.329254 + 443.503184, T_SECONDARY, TV_LOW); + s->addEvent2(95.329254 + 373.060597, T_SECONDARY, TV_HIGH PASS_ENGINE_PARAMETER); + s->addEvent2(95.329254 + 443.503184, T_SECONDARY, TV_LOW PASS_ENGINE_PARAMETER); - s->addEvent(95.329254 + 555.349776, T_SECONDARY, TV_HIGH); - s->addEvent(720, T_SECONDARY, TV_LOW); + s->addEvent2(95.329254 + 555.349776, T_SECONDARY, TV_HIGH PASS_ENGINE_PARAMETER); + s->addEvent2(720, T_SECONDARY, TV_LOW PASS_ENGINE_PARAMETER); s->tdcPosition = 137.119154; s->isSynchronizationNeeded = false; diff --git a/firmware/controllers/trigger/trigger_mazda.h b/firmware/controllers/trigger/trigger_mazda.h index 3cebb6e863..08c53b5144 100644 --- a/firmware/controllers/trigger/trigger_mazda.h +++ b/firmware/controllers/trigger/trigger_mazda.h @@ -13,9 +13,9 @@ #define MIATA_NA_GAP 1.4930f -void initializeMazdaMiataNaShape(TriggerShape *s); -void initializeMazdaMiataNbShape(TriggerShape *s); -void configureMazdaProtegeSOHC(TriggerShape *s); -void configureMazdaProtegeLx(TriggerShape *s); +void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); +void initializeMazdaMiataNbShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); +void configureMazdaProtegeSOHC(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); +void configureMazdaProtegeLx(TriggerShape *s DECLARE_ENGINE_PARAMETER_S); #endif /* TRIGGER_MAZDA_H_ */ diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index 1f5f68f175..07b5e53392 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -251,6 +251,10 @@ operation_mode_e TriggerShape::getOperationMode() { extern bool printTriggerDebug; #endif +void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam DECLARE_ENGINE_PARAMETER_S) { + addEvent(angle, waveIndex, stateParam); +} + void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) { efiAssertVoid(operationMode != OM_NONE, "operationMode not set"); diff --git a/firmware/controllers/trigger/trigger_structure.h b/firmware/controllers/trigger/trigger_structure.h index 6dacff0447..dcb60a6735 100644 --- a/firmware/controllers/trigger/trigger_structure.h +++ b/firmware/controllers/trigger/trigger_structure.h @@ -124,6 +124,7 @@ public: */ int size; + void addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const state DECLARE_ENGINE_PARAMETER_S); void addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const state); void addEvent(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight); operation_mode_e getOperationMode();