rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
trigger_gm.cpp
Go to the documentation of this file.
1/**
2 * @file trigger_gm.cpp
3 *
4 * @date Mar 28, 2014
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 */
7
8#include "pch.h"
9
10#include "trigger_gm.h"
11
12#define GM_60_W 6
13
14static float addTooth(float offset, TriggerWaveform *s) {
15 s->addToothRiseFall(offset + GM_60_W / 2, GM_60_W / 2, TriggerWheel::T_SECONDARY);
16 return offset + GM_60_W;
17}
18
19/**
20 * https://github.com/rusefi/rusefi/issues/2264
21 * GM/Daewoo Distributor on the F8CV
22 */
25 s->isSynchronizationNeeded = false;
26 s->isSecondWheelCam = true;
27
28 int offset = 1;
29
30 for (int i=0;i<12;i++) {
32 }
33
34 offset += 2 * GM_60_W;
35
36 for (int i=0;i<18;i++) {
38 }
39
40 offset += 2 * GM_60_W;
41
42 for (int i=0;i<18;i++) {
44 }
45
46 offset += 2 * GM_60_W;
47
48 for (int i=0;i<5;i++) {
50 }
51
52 s->addEvent360(360 - GM_60_W, TriggerValue::RISE);
53
55
57
58}
59
62
63 float w = 5;
64
65 s->addToothRiseFall(60, w);
66
67 s->addToothRiseFall(120, w);
68
69 s->addToothRiseFall(180, w);
70
71 s->addToothRiseFall(240, w);
72
73 s->addToothRiseFall(300, w);
74
75 s->addToothRiseFall(350, w);
76
77 s->addToothRiseFall(360, w);
78
80}
81
82static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerWaveform* s, float shortToothWidth)
83{
84 int window = (isShortLong ? shortToothWidth : (15 - shortToothWidth));
85 int end = startAngle + 15;
86
87 s->addEvent360(startAngle + window, TriggerValue::RISE);
89
90 return end;
91}
92
93/**
94 * TT_GM_24x_5 and TT_GM_24x_3
95 * https://www.mediafire.com/?40mfgeoe4ctti
96 * http://www.ls1gto.com/forums/archive/index.php/t-190549.htm
97 * http://www.ls2.com/forums/showthread.php/834483-LS-Timing-Reluctor-Wheels-Explained
98 *
99 *
100 * based on data in https://rusefi.com/forum/viewtopic.php?f=3&t=936&p=30303#p30285
101 */
102static void initGmLS24(TriggerWaveform *s, float shortToothWidth) {
104
105 /*
106 * Okay, here's how this magic works:
107 * The GM 24x crank wheel has 48 edges. There is
108 * a falling edge every 15 degrees (1/24 revolution).
109 * After every falling edge, a rising edge occurs either
110 * 5 or 10 (= 15 - 5) degrees later. The code 0x0A33BE
111 * encodes the pattern of which type of gap occurs in the
112 * pattern. Starting from the LSB, each bit left is the
113 * next gap in sequence as the crank turns. A 0 indicates
114 * long-short (late rising edge), while a 1 indicates
115 * short-long (early rising edge).
116 *
117 * The first few bits read are 0xE (LSB first!) = 0 - 1 - 1 - 1, so the pattern
118 * looks like this:
119 * ___ _ ___ ___ _
120 * |___| |_| |_| |___| |_ etc
121 *
122 * | 0 | 1 | 1 | 0 |
123 *
124 * ___ = 10 degrees, _ = 5 deg
125 *
126 * There is a falling edge at angle=0=720, and this is position
127 * is #1 (and #6) TDC. If there's a falling edge on the cam
128 * sensor, it's #1 end compression stroke (fire this plug!)
129 * and #6 end exhaust stroke. If rising, it's exhaust #1,
130 * compression #6.
131 */
132
133 uint32_t code = 0x0A33BE;
134
135 int angle = 0;
136
137 for(int i = 0; i < 24; i++)
138 {
139 bool bit = code & 0x000001;
140 code = code >> 1;
141
142 angle = gm_tooth_pair(angle, bit, s, shortToothWidth);
143 }
144}
145
146// TT_GM_24x_5
148 initGmLS24(s, 5);
149
150 // This is tooth #20, at 310 degrees ATDC #1
154
155 s->tdcPosition = 50;
156}
157
158// TT_GM_24x_3
160 initGmLS24(s, 3);
161
162 // This is tooth #20, at 312 degrees ATDC #1
166
167 s->tdcPosition = 48;
168}
uint8_t code
Definition bluetooth.cpp:40
Trigger shape has all the fields needed to describe and decode trigger signal.
void initialize(operation_mode_e operationMode, SyncEdge syncEdge)
void setSecondTriggerSynchronizationGap(float syncRatio)
void setTriggerSynchronizationGap(float syncRatio)
void addToothRiseFall(angle_t angle, angle_t width=10, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void setThirdTriggerSynchronizationGap(float syncRatio)
@ FOUR_STROKE_CRANK_SENSOR
@ FOUR_STROKE_CAM_SENSOR
static void initGmLS24(TriggerWaveform *s, float shortToothWidth)
void initGmLS24_3deg(TriggerWaveform *s)
static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerWaveform *s, float shortToothWidth)
void configureGmTriggerWaveform(TriggerWaveform *s)
void initGmLS24_5deg(TriggerWaveform *s)
void configureGm60_2_2_2(TriggerWaveform *s)
static float addTooth(float offset, TriggerWaveform *s)
uint16_t offset
Definition tunerstudio.h:0