trigger refactoring: we are long overdue for better api, also reducing CRANK_MODE_MULTIPLIER crazy

This commit is contained in:
Andrey 2023-05-13 14:46:32 -04:00
parent d13610e1f1
commit 8b84b83e1a
3 changed files with 16 additions and 32 deletions

View File

@ -62,26 +62,19 @@ void configureGmTriggerWaveform(TriggerWaveform *s) {
float w = 5;
s->addEvent360(60 - w, TriggerValue::RISE);
s->addEvent360(60, TriggerValue::FALL);
s->addToothRiseFall(60, w);
s->addEvent360(120 - w, TriggerValue::RISE);
s->addEvent360(120.0, TriggerValue::FALL);
s->addToothRiseFall(120, w);
s->addEvent360(180 - w, TriggerValue::RISE);
s->addEvent360(180, TriggerValue::FALL);
s->addToothRiseFall(180, w);
s->addEvent360(240 - w, TriggerValue::RISE);
s->addEvent360(240.0, TriggerValue::FALL);
s->addToothRiseFall(240, w);
s->addEvent360(300 - w, TriggerValue::RISE);
s->addEvent360(300.0, TriggerValue::FALL);
s->addToothRiseFall(300, w);
s->addEvent360(350 - w, TriggerValue::RISE);
s->addEvent360(350.0, TriggerValue::FALL);
s->addToothRiseFall(350, w);
s->addEvent360(360 - w, TriggerValue::RISE);
s->addEvent360(360.0, TriggerValue::FALL);
s->addToothRiseFall(360, w);
s->setTriggerSynchronizationGap(6);
}

View File

@ -56,15 +56,14 @@ void configureOnePlus16(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
int count = 16;
float tooth = s->getCycleDuration() / count;
float tooth = s->getCycleDuration() / 2 / count;
float width = tooth / 2; // for VR we only handle rises so width does not matter much
s->addEventAngle(1, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
s->addEventAngle(5, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
for (int i = 1; i <= count; i++) {
s->addEventAngle(tooth * i - width, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
s->addEventAngle(tooth * i, TriggerValue::FALL, TriggerWheel::T_SECONDARY);
s->addToothRiseFall(tooth * i, width, TriggerWheel::T_SECONDARY);
}
s->isSynchronizationNeeded = false;

View File

@ -37,25 +37,17 @@ void initializeNissanSR20VE_4(TriggerWaveform *s) {
s->addEvent720(4 * 180, TriggerValue::FALL);
}
static void addPrimaryToothEndingAt(TriggerWaveform *s, float fallAngle) {
int vvtWidth = 20;
s->addEventAngle(fallAngle - vvtWidth, TriggerValue::RISE);
s->addEventAngle(fallAngle, TriggerValue::FALL);
}
void initializeNissanVQvvt(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
int offset = 720 - 520;
int offset = 360 - 260;
addPrimaryToothEndingAt(s, offset + 40);
addPrimaryToothEndingAt(s, offset + 160);
addPrimaryToothEndingAt(s, offset + 200);
addPrimaryToothEndingAt(s, offset + 280);
addPrimaryToothEndingAt(s, offset + 320);
addPrimaryToothEndingAt(s, offset + 520);
s->addToothRiseFall(offset + 20);
s->addToothRiseFall(offset + 80);
s->addToothRiseFall(offset + 100);
s->addToothRiseFall(offset + 140);
s->addToothRiseFall(offset + 160);
s->addToothRiseFall(offset + 260);
s->setTriggerSynchronizationGap2(4, 6);
s->setSecondTriggerSynchronizationGap2(0.35f, 0.7f);