2018-10-30 01:46:13 -07:00
|
|
|
/*
|
|
|
|
* trigger_misc.cpp
|
|
|
|
*
|
|
|
|
* Created on: Oct 30, 2018
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2018-10-30 01:46:13 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "trigger_misc.h"
|
2021-01-03 11:05:24 -08:00
|
|
|
#include "trigger_universal.h"
|
2018-10-30 01:46:13 -07:00
|
|
|
|
2018-10-30 02:32:13 -07:00
|
|
|
// TT_FIAT_IAW_P8
|
2019-12-07 22:09:39 -08:00
|
|
|
void configureFiatIAQ_P8(TriggerWaveform * s) {
|
2020-01-12 07:43:02 -08:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
2018-10-30 01:46:13 -07:00
|
|
|
|
2018-10-30 02:32:13 -07:00
|
|
|
int width = 60;
|
|
|
|
s->tdcPosition = width;
|
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(180, T_PRIMARY, TV_FALL);
|
2018-10-30 02:32:13 -07:00
|
|
|
|
2018-12-25 08:51:49 -08:00
|
|
|
s->addEvent720(180 + width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEvent720(720, T_PRIMARY, TV_FALL);
|
2018-10-30 02:32:13 -07:00
|
|
|
s->setTriggerSynchronizationGap(3);
|
2018-10-30 01:46:13 -07:00
|
|
|
}
|
|
|
|
|
2021-01-03 11:05:24 -08:00
|
|
|
// TT_TRI_TACH
|
|
|
|
void configureTriTach(TriggerWaveform * s) {
|
|
|
|
s->initialize(FOUR_STROKE_CRANK_SENSOR);
|
|
|
|
|
|
|
|
s->isSynchronizationNeeded = false;
|
|
|
|
|
|
|
|
float toothWidth = 0.5;
|
|
|
|
|
|
|
|
float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
|
|
|
|
|
|
|
|
int totalTeethCount = 135;
|
|
|
|
float offset = 0;
|
|
|
|
|
|
|
|
float angleDown = engineCycle / totalTeethCount * (0 + (1 - toothWidth));
|
|
|
|
float angleUp = engineCycle / totalTeethCount * (0 + 1);
|
|
|
|
s->addEventClamped(offset + angleDown, T_PRIMARY, TV_RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
|
|
|
s->addEventClamped(offset + angleDown + 0.1, T_SECONDARY, TV_RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
|
|
|
s->addEventClamped(offset + angleUp, T_PRIMARY, TV_FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
|
|
|
s->addEventClamped(offset + angleUp + 0.1, T_SECONDARY, TV_FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER);
|
|
|
|
|
|
|
|
|
|
|
|
addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, /* skipped */ 0, toothWidth, offset, engineCycle,
|
2021-01-04 20:44:31 -08:00
|
|
|
1.0 * FOUR_STROKE_ENGINE_CYCLE / 135,
|
2021-01-03 21:26:05 -08:00
|
|
|
NO_RIGHT_FILTER);
|
2021-01-03 11:05:24 -08:00
|
|
|
}
|
|
|
|
|
2021-09-12 08:56:12 -07:00
|
|
|
/**
|
|
|
|
* based on https://fordsix.com/threads/understanding-standard-and-signature-pip-thick-film-ignition.81515/
|
|
|
|
* based on https://www.w8ji.com/distributor_stabbing.htm
|
|
|
|
*/
|
2021-09-11 20:42:05 -07:00
|
|
|
void configureFordPip(TriggerWaveform * s) {
|
2021-09-12 08:56:12 -07:00
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
|
|
|
|
2021-09-12 10:58:03 -07:00
|
|
|
s->tdcPosition = 662.5;
|
|
|
|
|
2021-09-12 08:56:12 -07:00
|
|
|
s->setTriggerSynchronizationGap(0.66);
|
|
|
|
s->setSecondTriggerSynchronizationGap(1.25);
|
|
|
|
/**
|
|
|
|
* sensor is mounted on distributor but trigger shape is defined in engine cycle angles
|
|
|
|
*/
|
|
|
|
int oneCylinder = s->getCycleDuration() / 8;
|
|
|
|
|
|
|
|
s->addEventAngle(oneCylinder * 0.75, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(oneCylinder, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 2;i<=8;i++) {
|
|
|
|
s->addEventAngle(oneCylinder * (i - 0.5), T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(oneCylinder * i, T_PRIMARY, TV_FALL);
|
|
|
|
}
|
2021-09-11 20:42:05 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-03 20:54:08 -08:00
|
|
|
void configureFordST170(TriggerWaveform * s) {
|
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
|
|
|
int width = 10;
|
|
|
|
|
|
|
|
int total = s->getCycleDuration() / 8;
|
|
|
|
|
|
|
|
s->addEventAngle(1 * total - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(1 * total, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
s->addEventAngle(2 * total - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(2 * total, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
s->addEventAngle(4 * total - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(4 * total, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
s->addEventAngle(6 * total - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(6 * total, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
s->addEventAngle(8 * total - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(8 * total, T_PRIMARY, TV_FALL);
|
|
|
|
}
|
2020-12-03 20:12:30 -08:00
|
|
|
|
|
|
|
void configureDaihatsu4(TriggerWaveform * s) {
|
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
|
|
|
|
|
|
|
int width = 10;
|
|
|
|
|
|
|
|
s->setTriggerSynchronizationGap(0.125);
|
|
|
|
|
2020-12-03 20:54:08 -08:00
|
|
|
s->addEventAngle(30 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(30, T_PRIMARY, TV_FALL);
|
2020-12-03 20:12:30 -08:00
|
|
|
|
|
|
|
|
2020-12-03 20:54:08 -08:00
|
|
|
s->addEventAngle(s->getCycleDuration() / 3 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(s->getCycleDuration() / 3, T_PRIMARY, TV_FALL);
|
2020-12-03 20:12:30 -08:00
|
|
|
|
2020-12-03 20:54:08 -08:00
|
|
|
s->addEventAngle(s->getCycleDuration() / 3 * 2 - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(s->getCycleDuration() / 3 * 2, T_PRIMARY, TV_FALL);
|
2020-12-03 20:12:30 -08:00
|
|
|
|
2020-12-03 20:54:08 -08:00
|
|
|
s->addEventAngle(s->getCycleDuration() - width, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(s->getCycleDuration(), T_PRIMARY, TV_FALL);
|
2020-12-03 20:12:30 -08:00
|
|
|
|
|
|
|
}
|
2021-03-22 04:48:29 -07:00
|
|
|
|
|
|
|
void configureBarra3plus1cam(TriggerWaveform *s) {
|
|
|
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
|
|
|
|
|
|
|
s->useRiseEdge = true;
|
|
|
|
// TODO: gapBothDirections?
|
|
|
|
|
|
|
|
// This wheel has four teeth
|
|
|
|
// two short gaps, and two long gaps
|
|
|
|
// short = 60 deg
|
|
|
|
// long = 120 deg
|
|
|
|
|
|
|
|
{
|
|
|
|
int offset = 120;
|
|
|
|
|
|
|
|
s->addEventAngle(offset + 2 * 0 - 10, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(offset + 2 * 0 + 0, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
// short gap 60 deg
|
|
|
|
|
|
|
|
s->addEventAngle(offset + 2 * 60 - 10, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(offset + 2 * 60 + 0, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
// long gap 120 deg
|
|
|
|
|
|
|
|
s->addEventAngle(offset + 2 * 180 - 10, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(offset + 2 * 180 + 0, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
// long gap 120 deg
|
|
|
|
|
|
|
|
s->addEventAngle(offset + 2 * 300 - 10, T_PRIMARY, TV_RISE);
|
|
|
|
s->addEventAngle(offset + 2 * 300 + 0, T_PRIMARY, TV_FALL);
|
|
|
|
|
|
|
|
// short gap, 60 deg back to zero/720
|
|
|
|
}
|
|
|
|
|
|
|
|
// sync tooth is the zero tooth, the first short gap after two long gaps
|
|
|
|
s->setTriggerSynchronizationGap3(0, 1.6f, 2.4f);
|
|
|
|
// previous gap should be 1.0
|
|
|
|
s->setTriggerSynchronizationGap3(1, 0.8f, 1.2f);
|
|
|
|
}
|