fome-fw/firmware/controllers/trigger/decoders/trigger_vw.cpp

49 lines
1.2 KiB
C++
Raw Normal View History

2018-08-25 17:05:17 -07:00
/*
* @file trigger_vw.cpp
*
* @date Aug 25, 2018
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2018-08-25 17:05:17 -07:00
*/
#include "trigger_vw.h"
#include "trigger_universal.h"
#include "error_handling.h"
2018-08-25 17:05:17 -07:00
void setSkodaFavorit(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR);
int m = 2;
s->addEvent720(m * 46, T_PRIMARY, TV_RISE);
s->addEvent720(m * 177, T_PRIMARY, TV_FALL);
s->addEvent720(m * 180, T_PRIMARY, TV_RISE);
s->addEvent720(m * 183, T_PRIMARY, TV_FALL);
2018-08-25 17:05:17 -07:00
s->addEvent720(m * 226, T_PRIMARY, TV_RISE);
s->addEvent720(m * 360, T_PRIMARY, TV_FALL);
}
void setVwConfiguration(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR);
2018-08-25 17:05:17 -07:00
s->isSynchronizationNeeded = true;
int totalTeethCount = 60;
int skippedCount = 2;
2019-01-01 11:05:11 -08:00
float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
2018-08-25 17:05:17 -07:00
float toothWidth = 0.5;
addSkippedToothTriggerEvents(T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle,
2018-12-25 16:42:27 -08:00
NO_LEFT_FILTER, 690);
2018-08-25 17:05:17 -07:00
float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + (1 - toothWidth) );
2019-05-02 15:05:33 -07:00
s->addEventClamped(0 + angleDown + 12, T_PRIMARY, TV_RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER);
s->addEventClamped(0 + engineCycle, T_PRIMARY, TV_FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER);
2018-08-25 17:05:17 -07:00
s->setTriggerSynchronizationGap2(1.6, 4);
}