rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
trigger_renix.cpp
Go to the documentation of this file.
1/**
2 * @file trigger_renix.cpp
3 *
4 * https://en.wikipedia.org/wiki/Renix
5 * Has something to do with AMC/Jeep
6 *
7 * @date Apr 18, 2020
8 * @author Andrey Belomutskiy, (c) 2012-2020
9 */
10
11#include "pch.h"
12
13#include "trigger_renix.h"
14
16 // 44-2-2 is symmetrical so we only need to define one half
17 int count = 22;
18 float tooth = s->getCycleDuration() / count; // hint: tooth = 8.181818 degrees
19
20 float currentAngle = 0;
21 for (int i = 0;i < 20;i++) {
22 s->addEventAngle(currentAngle + tooth / 2, TriggerValue::RISE);
23 s->addEventAngle(currentAngle + tooth, TriggerValue::FALL);
24 currentAngle += tooth;
25 }
26
27 s->addEventAngle(currentAngle + tooth, TriggerValue::RISE);
28
29 // float math error accumulates at this point so we have to spell out 180
31}
32
33// TT_RENIX_44_2_2
38
39// TT_RENIX_66_2_2_2
44
45// basically like the "normal" renix 22-2 pattern -> 66-2-2-2, except without the extra random tooth there in the middle.
46// this is copied from vq35 36-2-2-2 pattern.
47void JeepRenix66_2_2(TriggerWaveform* s, size_t halfCylinderCount, size_t totalWheel, size_t missing) {
48
49 auto toothAngle = 360.0f / totalWheel;
50
51 auto patternTeeth = totalWheel / halfCylinderCount;
52 auto toothCount = patternTeeth - missing;
53
54 float currentAngle = missing * toothAngle;
55 for (size_t i = 0; i < toothCount; i++) {
56 currentAngle += toothAngle;
57 s->addEventAngle(currentAngle - (toothAngle/2), TriggerValue::RISE);
58 if (i==toothCount-1) { // last event at 120
60 } else {
61 s->addEventAngle(currentAngle, TriggerValue::FALL);
62 }
63 }
64}
65
66// TT_JEEPRENIX_66_2_2_2
69
70 // 6 cylinder = 66 tooth wheel, missing 2 teeth in 3 spots
71 JeepRenix66_2_2(s, 3, 66, 2);
72 s->setTriggerSynchronizationGap3(/*gapIndex*/0, 0.2, 0.5);
73 s->setTriggerSynchronizationGap3(/*gapIndex*/1, 2, 4);
74 s->setTriggerSynchronizationGap3(/*gapIndex*/2, 0.6, 1.4);
75}
Trigger shape has all the fields needed to describe and decode trigger signal.
void initialize(operation_mode_e operationMode, SyncEdge syncEdge)
angle_t getCycleDuration() const
void addEventAngle(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo)
@ FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
@ FOUR_STROKE_THREE_TIMES_CRANK_SENSOR
void initializeRenix66_2_2(TriggerWaveform *s)
void initializeRenix44_2_2(TriggerWaveform *s)
void JeepRenix66_2_2(TriggerWaveform *s, size_t halfCylinderCount, size_t totalWheel, size_t missing)
void initializeJeepRenix66_2_2(TriggerWaveform *s)
static void commonRenix(TriggerWaveform *s)
uint16_t count
Definition tunerstudio.h:1