2015-12-14 10:01:18 -08:00
|
|
|
/*
|
|
|
|
* @file trigger_toyota.cpp
|
|
|
|
*
|
|
|
|
* https://thedeltaecho.wordpress.com/2010/03/14/2jz-ge-cam-crank-signals/
|
|
|
|
*
|
|
|
|
* @date Dec 14, 2015
|
2015-12-31 13:02:30 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2016
|
2015-12-14 10:01:18 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "trigger_toyota.h"
|
|
|
|
|
2015-12-14 18:01:30 -08:00
|
|
|
EXTERN_ENGINE;
|
2015-12-14 10:01:18 -08:00
|
|
|
|
2016-06-13 13:03:13 -07:00
|
|
|
void initialize2jzGE1_12(TriggerShape *s) {
|
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
|
|
|
|
|
|
|
|
float crankD = 360 / 12 / 2; // 15
|
|
|
|
|
|
|
|
float crankAngle = 10;
|
2016-06-13 17:01:47 -07:00
|
|
|
s->addEvent(crankAngle, T_SECONDARY, TV_FALL, -1, 721); // 120
|
2016-06-13 13:03:13 -07:00
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
s->addEvent(crankAngle + crankD, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
crankAngle += crankD;
|
|
|
|
s->addEvent(crankAngle + crankD, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += crankD;
|
2016-06-13 17:01:47 -07:00
|
|
|
}
|
2016-06-13 13:03:13 -07:00
|
|
|
|
|
|
|
|
2016-06-23 05:03:08 -07:00
|
|
|
s->addEvent(75, T_PRIMARY, TV_FALL, -1, 721);
|
2016-06-13 13:03:13 -07:00
|
|
|
|
2016-06-13 17:01:47 -07:00
|
|
|
for (int i = 0; i < 21; i++) {
|
|
|
|
s->addEvent(crankAngle + crankD, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
crankAngle += crankD;
|
|
|
|
s->addEvent(crankAngle + crankD, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += crankD;
|
|
|
|
}
|
|
|
|
|
|
|
|
s->addEvent(crankAngle + crankD, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
crankAngle += crankD;
|
2016-06-13 13:03:13 -07:00
|
|
|
|
|
|
|
|
2016-06-23 05:03:08 -07:00
|
|
|
s->addEvent(720, T_PRIMARY, TV_RISE, -1, 721);
|
2016-06-13 13:03:13 -07:00
|
|
|
|
|
|
|
s->isSynchronizationNeeded = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initialize2jzGE3_34(TriggerShape *s) {
|
2016-06-11 20:02:58 -07:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
|
2015-12-14 18:01:30 -08:00
|
|
|
|
2016-06-11 20:02:58 -07:00
|
|
|
float camD = 720 / 6; // 120
|
|
|
|
|
|
|
|
float crankAngle = 20; // skipping two teeth
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 10
|
|
|
|
|
|
|
|
float camAngle = 0;
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_RISE, -1, 721); // 120
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 22
|
|
|
|
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_FALL, -1, 721); // 240
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 34
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_RISE, -1, 721); // 360
|
|
|
|
|
|
|
|
crankAngle += 20; // skipping two teeth one more time
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 10
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_FALL, -1, 721); // 480
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 22
|
|
|
|
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_RISE, -1, 721); // 600
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
s->addEvent(crankAngle + 5, T_SECONDARY, TV_RISE, -1, 721);
|
|
|
|
s->addEvent(crankAngle + 9.9, T_SECONDARY, TV_FALL, -1, 721); // 120
|
|
|
|
crankAngle += 10;
|
|
|
|
} // 2 + 32
|
|
|
|
camAngle += camD;
|
|
|
|
s->addEvent(camAngle, T_PRIMARY, TV_FALL, -1, 721); // 720
|
2015-12-14 18:01:30 -08:00
|
|
|
|
|
|
|
s->isSynchronizationNeeded = false;
|
|
|
|
|
|
|
|
}
|