2015-09-19 16:01:46 -07:00
|
|
|
/**
|
|
|
|
* @file trigger_nissan.cpp
|
|
|
|
*
|
2017-12-31 17:13:20 -08:00
|
|
|
* https://rusefi.com/forum/viewtopic.php?f=3&t=1194&start=150#p27784
|
|
|
|
*
|
2015-09-19 16:01:46 -07:00
|
|
|
* @date Sep 19, 2015
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-09-19 16:01:46 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "trigger_nissan.h"
|
2017-04-02 14:59:01 -07:00
|
|
|
#include "trigger_universal.h"
|
2015-09-19 16:01:46 -07:00
|
|
|
|
2017-12-31 17:13:20 -08:00
|
|
|
/**
|
|
|
|
* 8,2,2,2 Nissan pattern
|
|
|
|
*/
|
2017-05-15 20:28:49 -07:00
|
|
|
static void initializeNissanSR20VE_4_optional_360(TriggerShape *s, bool with2nd DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
2017-04-02 14:36:59 -07:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, with2nd);
|
2017-03-18 17:59:52 -07:00
|
|
|
s->isSynchronizationNeeded = true;
|
|
|
|
s->gapBothDirections = true;
|
2017-04-02 14:36:59 -07:00
|
|
|
s->useOnlyPrimaryForSync = true;
|
2015-09-19 17:01:38 -07:00
|
|
|
|
2017-03-22 08:39:20 -07:00
|
|
|
s->tdcPosition = 630;
|
|
|
|
|
2018-01-01 19:24:33 -08:00
|
|
|
float width = 4;
|
2017-03-22 04:07:02 -07:00
|
|
|
s->setTriggerSynchronizationGap2(9.67 * 0.75, 16);
|
2015-09-19 17:01:38 -07:00
|
|
|
|
2017-04-02 14:59:01 -07:00
|
|
|
float left = 0;
|
|
|
|
float right;
|
|
|
|
|
|
|
|
int total = 360; // 360 on cam, over 720 crank degree
|
|
|
|
|
2015-09-19 17:01:38 -07:00
|
|
|
float base = 180;
|
2018-01-01 19:24:33 -08:00
|
|
|
right = base - 4 * width;
|
2017-04-02 14:59:01 -07:00
|
|
|
|
|
|
|
if (with2nd) {
|
2017-04-02 15:12:51 -07:00
|
|
|
addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 14:59:01 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 14:59:01 -07:00
|
|
|
|
2017-04-02 15:12:51 -07:00
|
|
|
left = right;
|
2017-04-02 14:59:01 -07:00
|
|
|
right = base;
|
2017-04-02 15:12:51 -07:00
|
|
|
if (with2nd) {
|
2017-04-02 15:14:30 -07:00
|
|
|
addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
}
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
2015-09-19 17:01:38 -07:00
|
|
|
|
2015-12-28 15:01:45 -08:00
|
|
|
// was is the the one with 360 opto sensor?
|
|
|
|
|
2015-09-19 17:01:38 -07:00
|
|
|
base += 180;
|
2017-04-02 15:12:51 -07:00
|
|
|
|
|
|
|
left = right;
|
2018-01-01 19:24:33 -08:00
|
|
|
right = base - width;
|
2017-04-02 15:12:51 -07:00
|
|
|
if (with2nd) {
|
|
|
|
// addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
// left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
}
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
|
|
|
|
left = right;
|
|
|
|
right = base;
|
|
|
|
if (with2nd) {
|
|
|
|
// addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
// left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
}
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-03-18 17:18:21 -07:00
|
|
|
|
2015-09-19 17:01:38 -07:00
|
|
|
base += 180;
|
2017-04-02 15:12:51 -07:00
|
|
|
left = right;
|
2018-01-01 19:24:33 -08:00
|
|
|
right = base - width;
|
2017-04-02 15:12:51 -07:00
|
|
|
if (with2nd) {
|
|
|
|
// addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
// left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
}
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
|
|
|
|
left = right;
|
|
|
|
right = base;
|
|
|
|
if (with2nd) {
|
|
|
|
// addSkippedToothTriggerEvents(T_SECONDARY, s, total, 0, 0.5, 0, 720,
|
2017-05-15 20:28:49 -07:00
|
|
|
// left, right PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
}
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
2015-09-19 17:01:38 -07:00
|
|
|
|
2017-03-18 17:18:21 -07:00
|
|
|
base += 180;
|
2017-04-02 15:12:51 -07:00
|
|
|
left = right;
|
2018-01-01 19:24:33 -08:00
|
|
|
right = base - width;
|
2017-04-02 14:36:59 -07:00
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 15:12:51 -07:00
|
|
|
left = right;
|
|
|
|
right = base;
|
2017-05-15 20:28:49 -07:00
|
|
|
s->addEvent2(right, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);
|
2015-09-19 16:01:46 -07:00
|
|
|
}
|
2017-03-22 19:53:10 -07:00
|
|
|
|
|
|
|
|
2017-04-02 14:36:59 -07:00
|
|
|
/**
|
|
|
|
* Nissan Primera p11 year 1995-2002
|
|
|
|
*/
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void initializeNissanSR20VE_4(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|
|
|
initializeNissanSR20VE_4_optional_360(s, false PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-04-02 14:36:59 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void initializeNissanSR20VE_4_360(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|
|
|
initializeNissanSR20VE_4_optional_360(s, true PASS_ENGINE_PARAMETER_SUFFIX);
|
2017-03-22 19:53:10 -07:00
|
|
|
}
|