SR20VE trigger

This commit is contained in:
rusefi 2017-03-18 20:59:52 -04:00
parent e68e2da3a1
commit b9c422efd3
6 changed files with 15 additions and 9 deletions

View File

@ -13,7 +13,7 @@
#include "nissan_primera.h"
void setNissanPrimeraEngineConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->trigger.type = TT_NISSAN_SR20VE;
}
#endif /* EFI_SUPPORT_NISSAN_PRIMERA */

View File

@ -7,17 +7,22 @@
#include "trigger_nissan.h"
/**
* Nissan Primera p11 year 1995-2002
*/
void initializeNissanSR20VE(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
s->initialize(FOUR_STROKE_CAM_SENSOR, false);
s->isSynchronizationNeeded = false;
s->isSynchronizationNeeded = true;
s->gapBothDirections = true;
float w = 5;
s->setTriggerSynchronizationGap(11.6);
float base = 180;
s->addEvent2(base - w, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base - 15, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
// todo: what was this about? :) what Nissan? Need to dig the forum around Sep 19, 2015
// was is the the one with 360 opto sensor?
base += 180;
@ -31,5 +36,4 @@ void initializeNissanSR20VE(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
base += 180;
s->addEvent2(base - w, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
}

View File

@ -127,8 +127,8 @@ bool isTriggerDecoderError(void);
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
#define isLessImportant(type) ((TRIGGER_SHAPE(useRiseEdge) && type != TV_RISE) \
|| (!TRIGGER_SHAPE(useRiseEdge) && type != TV_FALL) \
#define isLessImportant(type) (!TRIGGER_SHAPE(gapBothDirections) && (TRIGGER_SHAPE(useRiseEdge) && type != TV_RISE) \
|| (!TRIGGER_SHAPE(gapBothDirections) && !TRIGGER_SHAPE(useRiseEdge) && type != TV_FALL) \
|| (!considerEventForGap()) \
)

View File

@ -100,6 +100,7 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri
tdcPosition = 0;
shapeDefinitionError = useOnlyPrimaryForSync = false;
useRiseEdge = true;
gapBothDirections = false;
invertOnAdd = false;

View File

@ -106,7 +106,6 @@ public:
bool useOnlyPrimaryForSync;
/**
* Should we use falls or rises for gap ratio detection?
* todo: combine this flag with gapBothDirections?
*/
bool useRiseEdge;
/**
@ -114,7 +113,7 @@ public:
* Should we measure gaps with both fall and rise signal edges?
* See also useOnlyPrimaryForSync
*/
// bool gapBothDirections;
bool gapBothDirections;
/**
* This is used for signal validation

View File

@ -507,6 +507,8 @@ void testTriggerDecoder(void) {
testTriggerDecoder2("SATURN_ION_2004", SATURN_ION_2004, 0, 0.9028, 0.0);
testTriggerDecoder2("NISSAN_PRIMERA", NISSAN_PRIMERA, 2, 0.9583, 0.0);
testTriggerDecoder2("test1+1", CUSTOM_ENGINE, 0, 0.7500, 0.2500);
testTriggerDecoder2("testCitroen", CITROEN_TU3JP, 0, 0.4833, 0);