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
*/
2021-07-25 22:05:17 -07:00
# include "pch.h"
2018-08-25 17:05:17 -07:00
# include "trigger_vw.h"
# include "trigger_universal.h"
2021-02-06 17:12:58 -08:00
void setSkodaFavorit ( TriggerWaveform * s ) {
2022-09-23 17:39:41 -07:00
s - > initialize ( FOUR_STROKE_CRANK_SENSOR , SyncEdge : : Rise ) ;
2021-02-06 17:12:58 -08:00
2022-11-16 11:28:43 -08:00
s - > addEvent360 ( 46 , TriggerValue : : RISE , TriggerWheel : : T_PRIMARY ) ;
s - > addEvent360 ( 177 , TriggerValue : : FALL , TriggerWheel : : T_PRIMARY ) ;
2021-02-06 17:12:58 -08:00
2022-11-16 11:28:43 -08:00
s - > addEvent360 ( 180 , TriggerValue : : RISE , TriggerWheel : : T_PRIMARY ) ;
s - > addEvent360 ( 183 , TriggerValue : : FALL , TriggerWheel : : T_PRIMARY ) ;
2021-02-06 17:12:58 -08:00
2022-11-16 11:28:43 -08:00
s - > addEvent360 ( 226 , TriggerValue : : RISE , TriggerWheel : : T_PRIMARY ) ;
s - > addEvent360 ( 360 , TriggerValue : : FALL , TriggerWheel : : T_PRIMARY ) ;
2021-02-06 17:12:58 -08:00
2021-02-06 17:53:30 -08:00
s - > tdcPosition = 180 - 46 ;
s - > setTriggerSynchronizationGap ( 3.91 ) ;
2021-02-06 17:12:58 -08:00
}
void setVwConfiguration ( TriggerWaveform * s ) {
2022-10-05 17:10:27 -07:00
s - > initialize ( FOUR_STROKE_CRANK_SENSOR , SyncEdge : : RiseOnly ) ;
2018-08-25 17:05:17 -07:00
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 ;
2022-09-11 00:46:50 -07:00
addSkippedToothTriggerEvents ( TriggerWheel : : 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 ) ) ;
2022-11-16 11:28:43 -08:00
s - > addEventClamped ( 0 + angleDown + 12 , TriggerValue : : RISE , TriggerWheel : : T_PRIMARY , NO_LEFT_FILTER , NO_RIGHT_FILTER ) ;
s - > addEventClamped ( 0 + engineCycle , TriggerValue : : FALL , TriggerWheel : : T_PRIMARY , NO_LEFT_FILTER , NO_RIGHT_FILTER ) ;
2018-08-25 17:05:17 -07:00
s - > setTriggerSynchronizationGap2 ( 1.6 , 4 ) ;
2021-06-27 09:31:03 -07:00
s - > setSecondTriggerSynchronizationGap ( 1 ) ; // this gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise
s - > setThirdTriggerSynchronizationGap ( 1 ) ;
2018-08-25 17:05:17 -07:00
}