GCC Code Coverage Report


Directory: ./
File: firmware/controllers/trigger/decoders/trigger_vw.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 25 0 25
Functions: 100.0% 2 0 2
Branches: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 /*
2 * @file trigger_vw.cpp
3 *
4 * @date Aug 25, 2018
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 */
7
8 #include "pch.h"
9 #include "trigger_vw.h"
10 #include "trigger_universal.h"
11
12 1 void setSkodaFavorit(TriggerWaveform *s) {
13 1 s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::Rise);
14
15 1 s->addEvent360(133, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
16 1 s->addEvent360(177, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
17
18 1 s->addEvent360(180, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
19 1 s->addEvent360(183, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
20
21 1 s->addEvent360(313, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
22 1 s->addEvent360(360, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
23
24 1 s->tdcPosition = 180 + 47;
25 1 s->setTriggerSynchronizationGap3(/*gapIndex*/0, 2, 4);
26 1 }
27
28 5 void setVwConfiguration(TriggerWaveform *s) {
29 5 s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
30
31 5 int totalTeethCount = 60;
32 5 int skippedCount = 2;
33
34 5 float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
35 5 float toothWidth = 0.5;
36
37 5 addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle,
38 NO_LEFT_FILTER, 690);
39
40 5 float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + (1 - toothWidth) );
41 5 s->addEventClamped(0 + angleDown + 12, TriggerValue::RISE, TriggerWheel::T_PRIMARY, NO_LEFT_FILTER, NO_RIGHT_FILTER);
42 5 s->addEventClamped(0 + engineCycle, TriggerValue::FALL, TriggerWheel::T_PRIMARY, NO_LEFT_FILTER, NO_RIGHT_FILTER);
43
44 5 s->setTriggerSynchronizationGap2(1.6, 4);
45 5 s->setSecondTriggerSynchronizationGap(1); // this gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise
46 5 s->setThirdTriggerSynchronizationGap(1);
47 5 }
48