2015-09-10 19:01:35 -07:00
|
|
|
/**
|
|
|
|
* @file trigger_subaru.cpp
|
|
|
|
*
|
|
|
|
* @date Sep 10, 2015
|
2018-01-20 17:55:31 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2018
|
2015-09-10 19:01:35 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "trigger_subaru.h"
|
|
|
|
|
2015-09-12 12:02:40 -07:00
|
|
|
/**
|
|
|
|
* This trigger is also used by Nissan and Mazda
|
|
|
|
*/
|
2017-05-15 20:28:49 -07:00
|
|
|
void initialize36_2_2_2(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
2015-10-29 11:02:52 -07:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
|
2015-09-10 20:01:32 -07:00
|
|
|
|
|
|
|
float wide = 30 * 2;
|
|
|
|
float narrow = 10 * 2;
|
2015-09-10 19:01:35 -07:00
|
|
|
|
2015-09-12 12:02:40 -07:00
|
|
|
s->isSynchronizationNeeded = true;
|
|
|
|
s->setTriggerSynchronizationGap(0.5);
|
|
|
|
s->setSecondTriggerSynchronizationGap(1);
|
2015-09-10 19:01:35 -07:00
|
|
|
|
2015-09-10 20:01:32 -07:00
|
|
|
float base = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(base + narrow / 2, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(base + narrow, T_PRIMARY, TV_FALL);
|
2015-09-10 20:01:32 -07:00
|
|
|
base += narrow;
|
|
|
|
}
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(base + wide / 2, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(base + wide, T_PRIMARY, TV_FALL);
|
2015-09-10 20:01:32 -07:00
|
|
|
base += wide;
|
|
|
|
|
|
|
|
for (int i = 0; i < 15; i++) {
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(base + narrow / 2, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(base + narrow, T_PRIMARY, TV_FALL);
|
2015-09-10 20:01:32 -07:00
|
|
|
base += narrow;
|
|
|
|
}
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(720 - wide - wide / 2, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(720 - wide, T_PRIMARY, TV_FALL);
|
2015-09-10 20:01:32 -07:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(720 - wide / 2, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(720, T_PRIMARY, TV_FALL);
|
2016-06-12 07:01:41 -07:00
|
|
|
s->useOnlyPrimaryForSync = true;
|
2015-09-10 19:01:35 -07:00
|
|
|
}
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void initializeSubaru7_6(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
2017-01-08 08:02:38 -08:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
|
|
|
|
|
|
|
|
float magic = 333;
|
2017-01-02 16:03:36 -08:00
|
|
|
|
|
|
|
float width = 5;
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(25 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(25, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic - 180 - 87 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic - 180 - 87, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic - 180 - 55 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic - 180 - 55, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic - 180 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic - 180, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(182 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(182, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic - 87 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic - 87, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic - 55 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic - 55, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(343 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(343, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(366 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(366, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(384 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(384, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic + 180 - 87 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 180 - 87, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic + 180 - 55 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 180 - 55, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic + 180 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 180, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(538 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(538, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(magic + 360 - 87 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 360 - 87, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic + 360 - 55 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 360 - 55, T_SECONDARY, TV_FALL);
|
|
|
|
s->addEvent720(magic + 360 - width, T_SECONDARY, TV_RISE);
|
|
|
|
s->addEvent720(magic + 360, T_SECONDARY, TV_FALL);
|
2017-01-08 08:02:38 -08:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(720 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(720, T_PRIMARY, TV_FALL);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
2017-01-16 09:04:34 -08:00
|
|
|
s->setTriggerSynchronizationGap2(4.9, 9);
|
2018-10-21 10:41:01 -07:00
|
|
|
s->setTriggerSynchronizationGap3(1, 0.6, 1.25);
|
2017-01-02 16:03:36 -08:00
|
|
|
|
|
|
|
s->isSynchronizationNeeded = true;
|
|
|
|
|
|
|
|
s->useOnlyPrimaryForSync = true;
|
|
|
|
|
|
|
|
}
|