rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
trigger_mazda.cpp
Go to the documentation of this file.
1/**
2 * @file trigger_mazda.cpp
3 *
4 * @date Feb 18, 2014
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 *
7 * This file is part of rusEfi - see http://rusefi.com
8 *
9 * rusEfi is free software; you can redistribute it and/or modify it under the terms of
10 * the GNU General Public License as published by the Free Software Foundation; either
11 * version 3 of the License, or (at your option) any later version.
12 *
13 * rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
14 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with this program.
18 * If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "pch.h"
22
23#include "trigger_mazda.h"
24
25#define NB_CRANK_MAGIC 70
26
29 s->isSecondWheelCam = true;
30
31 // nominal gap is 0.325
33 // nominal gap is ~1.52
35
36 s->tdcPosition = 5.181;
37
38 /**
39 * http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983
40 */
43
46 s->addEvent720(288.819688, TriggerValue::FALL, TriggerWheel::T_PRIMARY); // <-- This edge is the sync point
48
51
56 s->useOnlyPrimaryForSync = true;
57}
58
59// TT_MIATA_VVT
61 /**
62 * Note how we use 0..180 range while defining FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR trigger
63 * Note that only half of the physical wheel is defined here!
64 */
66
67 s->tdcPosition = 60 + 655;
68
69 // Nominal gap 70/110 = 0.636
70 s->setTriggerSynchronizationGap2(0.35f, 1.15f);
71 // Nominal gap 110/70 = 1.571
73
74 // todo: NB2 fronts are inverted comparing to NB1, life is not perfect :(
75 s->addEventAngle(180.0f - NB_CRANK_MAGIC - 4, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
76 s->addEventAngle(180.0f - NB_CRANK_MAGIC, TriggerValue::RISE, TriggerWheel::T_PRIMARY);
79}
80
81static void addNBCrankTooth(TriggerWaveform *s, angle_t angle) {
82 s->addToothRiseFall(angle / 2 + 2, 2, TriggerWheel::T_SECONDARY);
83}
84
87 s->setTriggerSynchronizationGap3(0, 0.065, 0.17f);
88 s->useOnlyPrimaryForSync = true;
89
90 s->tdcPosition = 276;
91
92 /**
93 * cam sensor is primary, crank sensor is secondary
94 */
96
97 addNBCrankTooth(s, offset + 66.0f);
98 addNBCrankTooth(s, offset + 66.0f + NB_CRANK_MAGIC);
99 addNBCrankTooth(s, offset + 66.0f + 180);
100 addNBCrankTooth(s, offset + 66.0f + 180 + NB_CRANK_MAGIC);
101
104
107
108 addNBCrankTooth(s, offset + 66.0f + 360);
109 addNBCrankTooth(s, offset + 66.0f + 360 + NB_CRANK_MAGIC);
110 addNBCrankTooth(s, offset + 66.0f + 540);
111 addNBCrankTooth(s, offset + 66.0f + 540 + NB_CRANK_MAGIC);
112
114}
115
119
122
123 float z = 0.093;
124 float a = 90;
125 s->addToothRiseFall(a, z * 360);
126
127 a += 90;
128 s->addToothRiseFall(a, z * 360);
129 a += 90;
130 s->addToothRiseFall(a, z * 360);
131 a += 90;
132 s->addToothRiseFall(a, z * 360);
133
134 s->isSynchronizationNeeded = false;
135 s->shapeWithoutTdc = true;
136}
137
140 s->isSecondWheelCam = true;
141 /**
142 * based on https://svn.code.sf.net/p/rusefi/code/trunk/misc/logs/1993_escort_gt/MAIN_rfi_report_2015-02-01%2017_39.csv
143 */
145
146 s->addEvent720(95.329254 + 14.876692, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
148
149 s->addEvent720(95.329254 + 137.119154, TriggerValue::FALL, TriggerWheel::T_PRIMARY);
150
151 s->addEvent720(95.329254 + 192.378308, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
153
154 s->addEvent720(95.329254 + 373.060597, TriggerValue::RISE, TriggerWheel::T_SECONDARY);
156
159
160 s->tdcPosition = 137.119154;
161 s->isSynchronizationNeeded = false;
162}
163
181
182// https://rusefi.com/forum/viewtopic.php?f=17&t=2417
183// Cam pattern for intake/exhaust on all Skyactiv-G (and maybe -D/-X)
186
187 int wide = 20;
188 int narrow = 10;
189
190 s->addToothRiseFall(70, wide);
191 s->addToothRiseFall(90, narrow);
192
193 s->addToothRiseFall(160, wide);
194 s->addToothRiseFall(180, narrow);
195
196 s->addToothRiseFall(270, wide);
197 s->addToothRiseFall(360, wide);
198
201 s->setThirdTriggerSynchronizationGap(1.12); // 3rd gap is not required but let's have it for some resiliency
202}
203
206
207 // 6 teeth:
208 // 0, 60, 90, 150, 180, 270
209 // Tooth at 0 is just before #1 TDC
210
211 // 60
214
215 // 90
218
219 // 150
222
223 // 180
226
227 // 270
230
231 // 0 (aka 360)
234
235 s->setTriggerSynchronizationGap3(0, 0.32, 0.8);
236 s->setTriggerSynchronizationGap3(1, 1.5, 2.5);
237 s->setTriggerSynchronizationGap3(2, 0.32, 0.8);
238}
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 addEventAngle(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void addEvent720(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex=TriggerWheel::T_PRIMARY)
void setSecondTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo)
void setThirdTriggerSynchronizationGap(float syncRatio)
void setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo)
void setTriggerSynchronizationGap3(int index, float syncRatioFrom, float syncRatioTo)
@ FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
@ FOUR_STROKE_CAM_SENSOR
float angle_t
void configureMazdaProtegeSOHC(TriggerWaveform *s)
void configureMazdaProtegeLx(TriggerWaveform *s)
static void addNBCrankTooth(TriggerWaveform *s, angle_t angle)
void initializeMazdaMiataVVtTestShape(TriggerWaveform *s)
static void initializeMazdaMiataNb1ShapeWithOffset(TriggerWaveform *s, float offset)
void initializeMazdaMiataNaShape(TriggerWaveform *s)
void initializeMazdaLCam(TriggerWaveform *s)
void initializeMazdaMiataVVtCamShape(TriggerWaveform *s)
void initializeMazdaMiataNb2Crank(TriggerWaveform *s)
void initializeMazdaSkyactivCam(TriggerWaveform *s)
uint16_t offset
Definition tunerstudio.h:0