just a trivial massive rename: TriggerState > TriggerWaveform

This commit is contained in:
rusefi 2019-12-08 01:09:39 -05:00
parent 0555d2170d
commit c5cfd21a70
55 changed files with 270 additions and 270 deletions

View File

@ -52,16 +52,16 @@ FsioState::FsioState() {
#endif
}
void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
void Engine::initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
// we have a confusing threading model so some synchronization would not hurt
bool alreadyLocked = lockAnyContext();
TRIGGER_SHAPE(initializeTriggerShape(logger,
TRIGGER_WAVEFORM(initializeTriggerWaveform(logger,
engineConfiguration->ambiguousOperationMode,
engineConfiguration->useOnlyRisingEdgeForTrigger, &engineConfiguration->trigger));
if (TRIGGER_SHAPE(bothFrontsRequired) && engineConfiguration->useOnlyRisingEdgeForTrigger) {
if (TRIGGER_WAVEFORM(bothFrontsRequired) && engineConfiguration->useOnlyRisingEdgeForTrigger) {
#if EFI_PROD_CODE || EFI_SIMULATOR
firmwareError(CUSTOM_ERR_BOTH_FRONTS_REQUIRED, "Inconsistent trigger setup");
#else
@ -70,9 +70,9 @@ void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SU
}
if (!TRIGGER_SHAPE(shapeDefinitionError)) {
if (!TRIGGER_WAVEFORM(shapeDefinitionError)) {
/**
* this instance is used only to initialize 'this' TriggerShape instance
* this instance is used only to initialize 'this' TriggerWaveform instance
* #192 BUG real hardware trigger events could be coming even while we are initializing trigger
*/
initState.resetTriggerState();
@ -82,14 +82,14 @@ void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SU
if (engine->triggerCentral.triggerShape.getSize() == 0) {
firmwareError(CUSTOM_ERR_TRIGGER_ZERO, "triggerShape size is zero");
}
engine->engineCycleEventCount = TRIGGER_SHAPE(getLength());
engine->engineCycleEventCount = TRIGGER_WAVEFORM(getLength());
}
if (!alreadyLocked) {
unlockAnyContext();
}
if (!TRIGGER_SHAPE(shapeDefinitionError)) {
if (!TRIGGER_WAVEFORM(shapeDefinitionError)) {
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);
}
#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */

View File

@ -194,7 +194,7 @@ public:
void periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
void initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
bool clutchUpState = false;
bool clutchDownState = false;

View File

@ -1296,7 +1296,7 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S
assertEngineReference();
#if EFI_ENGINE_CONTROL
ENGINE(eInitializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
ENGINE(initializeTriggerWaveform(logger PASS_ENGINE_PARAMETER_SUFFIX));
#endif
#if EFI_FSIO

View File

@ -1831,7 +1831,7 @@ typedef enum {
CUSTOM_ERR_PIN_ALREADY_USED_2 = 6134,
CUSTOM_ERR_ICU_STATE = 6135,
CUSTOM_ERR_TCHARGE_NOT_READY = 6136,
CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG = 6137,
CUSTOM_ERR_TRIGGER_WAVEFORM_TOO_LONG = 6137,
CUSTOM_ERR_FUEL_TABLE_NOT_READY = 6138,
CUSTOM_ERR_TCHARGE_NOT_READY2 = 6139,
@ -2093,7 +2093,7 @@ typedef enum {
CUSTOM_ERR_TRIGGER_SYNC = 9000,
CUSTOM_OBD_TRIGGER_SHAPE = 9001,
CUSTOM_OBD_TRIGGER_WAVEFORM = 9001,
/**
* This is not engine miss detection - this is only internal scheduler state validation
* Should not happen

View File

@ -103,7 +103,7 @@ typedef enum {
// used by unit test
// see https://github.com/rusefi/rusefi/issues/898
// see TriggerShape::bothFrontsRequired
// see TriggerWaveform::bothFrontsRequired
ISSUE_898 = 27,
MAZDA_626 = 28,

View File

@ -236,7 +236,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
angle_t start = interpolate2d("mapa", rpm, c->samplingAngleBins, c->samplingAngle);
efiAssertVoid(CUSTOM_ERR_MAP_START_ASSERT, !cisnan(start), "start");
angle_t offsetAngle = TRIGGER_SHAPE(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]);
angle_t offsetAngle = TRIGGER_WAVEFORM(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]);
efiAssertVoid(CUSTOM_ERR_MAP_AVG_OFFSET, !cisnan(offsetAngle), "offsetAngle");
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {

View File

@ -204,8 +204,8 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
ev->isSimultanious = isSimultanious;
if (TRIGGER_SHAPE(getSize()) < 1) {
warning(CUSTOM_ERR_NOT_INITIALIZED_TRIGGER, "uninitialized TriggerShape");
if (TRIGGER_WAVEFORM(getSize()) < 1) {
warning(CUSTOM_ERR_NOT_INITIALIZED_TRIGGER, "uninitialized TriggerWaveform");
return false;
}
@ -517,7 +517,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
prepareIgnitionPinIndices(CONFIG(ignitionMode) PASS_ENGINE_PARAMETER_SUFFIX);
TRIGGER_SHAPE(prepareShape());
TRIGGER_WAVEFORM(prepareShape());
}
#endif /* EFI_ENGINE_CONTROL */

View File

@ -67,4 +67,4 @@ void setSingleCoilDwell(DECLARE_CONFIG_PARAMETER_SIGNATURE);
// expectation is that for well-known triggers CONFIG(globalTriggerAngleOffset) would usually be zero
// while for toothed wheels user would have to provide a value
#define tdcPosition() \
(TRIGGER_SHAPE(tdcPosition) + CONFIG(globalTriggerAngleOffset))
(TRIGGER_WAVEFORM(tdcPosition) + CONFIG(globalTriggerAngleOffset))

View File

@ -571,7 +571,7 @@ static void setToothedWheel(int total, int skipped DECLARE_ENGINE_PARAMETER_SUFF
scheduleMsg(&logger, "toothed: total=%d/skipped=%d", total, skipped);
setToothedWheelConfiguration(&engine->triggerCentral.triggerShape, total, skipped, engineConfiguration->ambiguousOperationMode);
// initializeTriggerShape(&logger, engineConfiguration, engineConfiguration2);
// initializeTriggerWaveform(&logger, engineConfiguration, engineConfiguration2);
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
doPrintConfiguration();
}

View File

@ -7,7 +7,7 @@
#include "trigger_bmw.h"
static inline float addPair(TriggerShape *s, float a, float w) {
static inline float addPair(TriggerWaveform *s, float a, float w) {
s->addEvent720(a, T_SECONDARY, TV_RISE);
a += w;
s->addEvent720(a, T_SECONDARY, TV_FALL);
@ -15,7 +15,7 @@ static inline float addPair(TriggerShape *s, float a, float w) {
return a;
}
void configureMiniCooperTriggerShape(TriggerShape *s) {
void configureMiniCooperTriggerWaveform(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
// s->initialState[0] = 1;

View File

@ -9,5 +9,5 @@
#include "trigger_structure.h"
void configureMiniCooperTriggerShape(TriggerShape *s);
void configureMiniCooperTriggerWaveform(TriggerWaveform *s);

View File

@ -8,7 +8,7 @@
#include "trigger_chrysler.h"
#include "trigger_universal.h"
void initDodgeRam(TriggerShape *s) {
void initDodgeRam(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->useRiseEdge = true;
@ -25,7 +25,7 @@ void initDodgeRam(TriggerShape *s) {
s->useOnlyPrimaryForSync = true;
}
void configureNeon2003TriggerShapeCrank(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
void configureNeon2003TriggerWaveformCrank(TriggerWaveform *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
s->useRiseEdge = true;
@ -99,7 +99,7 @@ void configureNeon2003TriggerShapeCrank(TriggerShape *s DECLARE_ENGINE_PARAMETER
s->addEvent720(m * 360, T_PRIMARY, TV_RISE);
}
void configureNeon2003TriggerShapeCam(TriggerShape *s) {
void configureNeon2003TriggerWaveformCam(TriggerWaveform *s) {
// todo: move sync point so that two channel does not have false trigger issues
bool useOnlyPrimary = true;
@ -322,7 +322,7 @@ gap=1.43/0.71
}
}
void configureDodgeStratusTriggerShape(TriggerShape *s) {
void configureDodgeStratusTriggerWaveform(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, false);
s->isSynchronizationNeeded = true;
@ -388,7 +388,7 @@ void configureDodgeStratusTriggerShape(TriggerShape *s) {
s->addEvent720(angle + w, T_PRIMARY, TV_FALL);
}
static void configureNeon1995TriggerShapeCommon(bool withCam, TriggerShape *s) {
static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform *s) {
trigger_wheel_e crank = withCam ? T_SECONDARY : T_PRIMARY;
// voodoo magic - we always need 720 at the end
@ -448,17 +448,17 @@ static void configureNeon1995TriggerShapeCommon(bool withCam, TriggerShape *s) {
}
}
void configureNeon1995TriggerShapeOnlyCrank(TriggerShape *s) {
void configureNeon1995TriggerWaveformOnlyCrank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
s->setTriggerSynchronizationGap(3.79);
s->tdcPosition = 279;
configureNeon1995TriggerShapeCommon(false, s);
configureNeon1995TriggerWaveformCommon(false, s);
}
void configureNeon1995TriggerShape(TriggerShape *s) {
void configureNeon1995TriggerWaveform(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->setTriggerSynchronizationGap(0.8227);
@ -468,12 +468,12 @@ void configureNeon1995TriggerShape(TriggerShape *s) {
s->initialState[T_PRIMARY] = TV_RISE;
configureNeon1995TriggerShapeCommon(true, s);
configureNeon1995TriggerWaveformCommon(true, s);
s->useOnlyPrimaryForSync = true;
}
void initJeep18_2_2_2(TriggerShape *s) {
void initJeep18_2_2_2(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->isSynchronizationNeeded = true;
s->setTriggerSynchronizationGap(1);
@ -543,7 +543,7 @@ void initJeep18_2_2_2(TriggerShape *s) {
}
static void add4cylblock(int off, TriggerShape *s) {
static void add4cylblock(int off, TriggerWaveform *s) {
s->addEvent720(114 + off, T_SECONDARY, TV_RISE);
s->addEvent720(114 + off + 2, T_SECONDARY, TV_FALL);
@ -558,7 +558,7 @@ static void add4cylblock(int off, TriggerShape *s) {
}
// TT_JEEP_4_CYL
void initJeep_XJ_4cyl_2500(TriggerShape *s) {
void initJeep_XJ_4cyl_2500(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->isSynchronizationNeeded = true;
s->setTriggerSynchronizationGap(1);

View File

@ -13,16 +13,16 @@
#define CHRYSLER_NGC4_GAP 1
#define CHRYSLER_NGC6_GAP 1.5
void configureNeon1995TriggerShape(TriggerShape *s);
void configureNeon1995TriggerShapeOnlyCrank(TriggerShape *s);
void configureNeon1995TriggerWaveform(TriggerWaveform *s);
void configureNeon1995TriggerWaveformOnlyCrank(TriggerWaveform *s);
void configureNeon2003TriggerShapeCam(TriggerShape *s);
void configureNeon2003TriggerShapeCrank(TriggerShape *s);
void initDodgeRam(TriggerShape *s);
void configureNeon2003TriggerWaveformCam(TriggerWaveform *s);
void configureNeon2003TriggerWaveformCrank(TriggerWaveform *s);
void initDodgeRam(TriggerWaveform *s);
void configureDodgeStratusTriggerShape(TriggerShape *s);
void configureDodgeStratusTriggerWaveform(TriggerWaveform *s);
void initJeep18_2_2_2(TriggerShape *s);
void initJeep_XJ_4cyl_2500(TriggerShape *s);
void initJeep18_2_2_2(TriggerWaveform *s);
void initJeep_XJ_4cyl_2500(TriggerWaveform *s);
#endif /* TRIGGER_CHRYSLER_H_ */

View File

@ -7,7 +7,7 @@
#include "trigger_gm.h"
void configureGmTriggerShape(TriggerShape *s) {
void configureGmTriggerWaveform(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
// all angles are x2 here - so, 5 degree width is 10
@ -39,7 +39,7 @@ void configureGmTriggerShape(TriggerShape *s) {
s->setTriggerSynchronizationGap(6);
}
static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerShape* s, int mult)
static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerWaveform* s, int mult)
{
int window = (isShortLong ? 5 : 10) * mult;
int end = startAngle + mult * 15;
@ -59,7 +59,7 @@ static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerShape* s, in
*
* based on data in https://rusefi.com/forum/viewtopic.php?f=3&t=936&p=30303#p30285
*/
void initGmLS24(TriggerShape *s) {
void initGmLS24(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
/*

View File

@ -10,7 +10,7 @@
#include "trigger_structure.h"
void configureGmTriggerShape(TriggerShape *s);
void initGmLS24(TriggerShape *s);
void configureGmTriggerWaveform(TriggerWaveform *s);
void initGmLS24(TriggerWaveform *s);
#endif /* TRIGGER_GM_H_ */

View File

@ -10,7 +10,7 @@
#define S24 (720.0f / 24 / 2)
static float addAccordPair(TriggerShape *s, float sb, trigger_wheel_e const channelIndex) {
static float addAccordPair(TriggerWaveform *s, float sb, trigger_wheel_e const channelIndex) {
s->addEvent720(sb, channelIndex, TV_RISE);
sb += S24;
s->addEvent720(sb, channelIndex, TV_FALL);
@ -20,7 +20,7 @@ static float addAccordPair(TriggerShape *s, float sb, trigger_wheel_e const chan
}
#define DIP 7.5f
static float addAccordPair3(TriggerShape *s, float sb) {
static float addAccordPair3(TriggerWaveform *s, float sb) {
sb += DIP;
s->addEvent720(sb, T_CHANNEL_3, TV_RISE);
sb += DIP;
@ -33,7 +33,7 @@ static float addAccordPair3(TriggerShape *s, float sb) {
* Thank you Dip!
* http://forum.pgmfi.org/viewtopic.php?f=2&t=15570start=210#p139007
*/
void configureHondaAccordCDDip(TriggerShape *s) {
void configureHondaAccordCDDip(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->initialState[T_SECONDARY] = TV_RISE;
@ -102,7 +102,7 @@ void configureHondaAccordCDDip(TriggerShape *s) {
* '4' is conditional
* '24' is always secondary channel
*/
void configureHonda_1_4_24(TriggerShape *s, bool withOneEventSignal, bool withFourEventSignal,
void configureHonda_1_4_24(TriggerWaveform *s, bool withOneEventSignal, bool withFourEventSignal,
trigger_wheel_e const oneEventWave,
trigger_wheel_e const fourEventWave,
float prefix) {
@ -166,7 +166,7 @@ void configureHonda_1_4_24(TriggerShape *s, bool withOneEventSignal, bool withFo
s->useOnlyPrimaryForSync = true;
}
void configureHondaCbr600(TriggerShape *s) {
void configureHondaCbr600(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->useOnlyPrimaryForSync = true;
s->isSynchronizationNeeded = true;
@ -209,7 +209,7 @@ void configureHondaCbr600(TriggerShape *s) {
s->addEvent720(720.0f, T_PRIMARY, TV_RISE);
}
void configureHondaCbr600custom(TriggerShape *s) {
void configureHondaCbr600custom(TriggerWaveform *s) {
// w = 15
float w = 720 / 2 / 24;
@ -283,7 +283,7 @@ void configureHondaCbr600custom(TriggerShape *s) {
}
void configureHondaAccordShifted(TriggerShape *s) {
void configureHondaAccordShifted(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
float sb = S24;
@ -314,7 +314,7 @@ void configureHondaAccordShifted(TriggerShape *s) {
s->isSynchronizationNeeded = false;
}
void configureOnePlus16(TriggerShape *s, operation_mode_e operationMode) {
void configureOnePlus16(TriggerWaveform *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);

View File

@ -10,17 +10,17 @@
#include "trigger_structure.h"
void configureHondaAccordCDDip(TriggerShape *s);
void configureHondaAccordShifted(TriggerShape *s);
void configureHondaAccordCDDip(TriggerWaveform *s);
void configureHondaAccordShifted(TriggerWaveform *s);
void configureHonda_1_4_24(TriggerShape *s, bool withOneEventSignal, bool withFourEventSignal,
void configureHonda_1_4_24(TriggerWaveform *s, bool withOneEventSignal, bool withFourEventSignal,
trigger_wheel_e const oneEventWave,
trigger_wheel_e const fourEventWave,
float d);
void configureOnePlus16(TriggerShape *s, operation_mode_e operationMode);
void configureOnePlus16(TriggerWaveform *s, operation_mode_e operationMode);
void configureHondaCbr600(TriggerShape *s);
void configureHondaCbr600custom(TriggerShape *s);
void configureHondaCbr600(TriggerWaveform *s);
void configureHondaCbr600custom(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_HONDA_H_ */

View File

@ -20,7 +20,7 @@
#include "trigger_mazda.h"
void initializeMazdaMiataNaShape(TriggerShape *s) {
void initializeMazdaMiataNaShape(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->setTriggerSynchronizationGap2(1.4930 * 0.6f, 1.4930 * 1.3f);
s->useRiseEdge = false;
@ -56,7 +56,7 @@ void initializeMazdaMiataNaShape(TriggerShape *s) {
* by alexander-n8hgeg5e
* See https://rusefi.com/forum/viewtopic.php?f=5&t=1447
*/
void initialize_Mazda_Engine_z5_Shape(TriggerShape *s) {
void initialize_Mazda_Engine_z5_Shape(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, false);
/**
* My Signal is: 60, 60, 102, 60
@ -87,7 +87,7 @@ void initialize_Mazda_Engine_z5_Shape(TriggerShape *s) {
}
// TT_MIATA_VVT
void initializeMazdaMiataNb2Crank(TriggerShape *s) {
void initializeMazdaMiataNb2Crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, false);
float o = 160;
@ -101,7 +101,7 @@ void initializeMazdaMiataNb2Crank(TriggerShape *s) {
s->addEvent720(o + 4 * 140.0f, T_PRIMARY, TV_RISE);
}
static void initializeMazdaMiataNb1ShapeWithOffset(TriggerShape *s, float offset) {
static void initializeMazdaMiataNb1ShapeWithOffset(TriggerWaveform *s, float offset) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->setTriggerSynchronizationGap3(0, 0.065, 0.17f);
s->useRiseEdge = false;
@ -143,15 +143,15 @@ static void initializeMazdaMiataNb1ShapeWithOffset(TriggerShape *s, float offset
s->addEvent720(720.0f, T_PRIMARY, TV_RISE);
}
void initializeMazdaMiataNb1Shape(TriggerShape *s) {
void initializeMazdaMiataNb1Shape(TriggerWaveform *s) {
initializeMazdaMiataNb1ShapeWithOffset(s, 0);
}
void initializeMazdaMiataVVtTestShape(TriggerShape *s) {
void initializeMazdaMiataVVtTestShape(TriggerWaveform *s) {
initializeMazdaMiataNb1ShapeWithOffset(s, -22);
}
void configureMazdaProtegeSOHC(TriggerShape *s) {
void configureMazdaProtegeSOHC(TriggerWaveform *s) {
// todo: move to into configuration definition s->needSecondTriggerInput = FALSE;
@ -181,7 +181,7 @@ void configureMazdaProtegeSOHC(TriggerShape *s) {
s->isSynchronizationNeeded = false;
}
void configureMazdaProtegeLx(TriggerShape *s) {
void configureMazdaProtegeLx(TriggerWaveform *s) {
// todo: move to into configuration definition s->needSecondTriggerInput = FALSE;
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->useOnlyPrimaryForSync = true;

View File

@ -12,12 +12,12 @@
#define MIATA_NA_GAP 1.4930f
void initializeMazdaMiataNaShape(TriggerShape *s);
void initializeMazdaMiataNb1Shape(TriggerShape *s);
void initializeMazdaMiataNb2Crank(TriggerShape *s);
void initializeMazdaMiataVVtTestShape(TriggerShape *s);
void configureMazdaProtegeSOHC(TriggerShape *s);
void configureMazdaProtegeLx(TriggerShape *s);
void initialize_Mazda_Engine_z5_Shape(TriggerShape *s);
void initializeMazdaMiataNaShape(TriggerWaveform *s);
void initializeMazdaMiataNb1Shape(TriggerWaveform *s);
void initializeMazdaMiataNb2Crank(TriggerWaveform *s);
void initializeMazdaMiataVVtTestShape(TriggerWaveform *s);
void configureMazdaProtegeSOHC(TriggerWaveform *s);
void configureMazdaProtegeLx(TriggerWaveform *s);
void initialize_Mazda_Engine_z5_Shape(TriggerWaveform *s);
#endif /* TRIGGER_MAZDA_H_ */

View File

@ -8,7 +8,7 @@
#include "trigger_misc.h"
// TT_FIAT_IAW_P8
void configureFiatIAQ_P8(TriggerShape * s) {
void configureFiatIAQ_P8(TriggerWaveform * s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, false);
s->isSynchronizationNeeded = true;

View File

@ -10,6 +10,6 @@
#include "trigger_structure.h"
void configureFiatIAQ_P8(TriggerShape * s);
void configureFiatIAQ_P8(TriggerWaveform * s);
#endif /* CONTROLLERS_TRIGGER_DECODERS_TRIGGER_MISC_H_ */

View File

@ -7,7 +7,7 @@
#include "trigger_mitsubishi.h"
void configureFordAspireTriggerShape(TriggerShape * s) {
void configureFordAspireTriggerWaveform(TriggerWaveform * s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->isSynchronizationNeeded = false;
@ -31,7 +31,7 @@ void configureFordAspireTriggerShape(TriggerShape * s) {
/**
* TT_MITSUBISHI = 11
*/
void initializeMitsubishi4g18(TriggerShape *s) {
void initializeMitsubishi4g18(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->useRiseEdge = false;

View File

@ -9,7 +9,7 @@
#include "trigger_structure.h"
void initializeMitsubishi4g18(TriggerShape *s);
void configureFordAspireTriggerShape(TriggerShape * s);
void initializeMitsubishi4g18(TriggerWaveform *s);
void configureFordAspireTriggerWaveform(TriggerWaveform * s);
#endif /* TRIGGER_MITSUBISHI_H_ */

View File

@ -13,7 +13,7 @@
/**
* 8,2,2,2 Nissan pattern
*/
static void initializeNissanSR20VE_4_optional_360(TriggerShape *s, bool with2nd) {
static void initializeNissanSR20VE_4_optional_360(TriggerWaveform *s, bool with2nd) {
s->initialize(FOUR_STROKE_CAM_SENSOR, with2nd);
s->isSynchronizationNeeded = true;
s->gapBothDirections = true;
@ -99,10 +99,10 @@ static void initializeNissanSR20VE_4_optional_360(TriggerShape *s, bool with2nd)
* Nissan Primera p11 year 1995-2002
*/
void initializeNissanSR20VE_4(TriggerShape *s) {
void initializeNissanSR20VE_4(TriggerWaveform *s) {
initializeNissanSR20VE_4_optional_360(s, false);
}
void initializeNissanSR20VE_4_360(TriggerShape *s) {
void initializeNissanSR20VE_4_360(TriggerWaveform *s) {
initializeNissanSR20VE_4_optional_360(s, true);
}

View File

@ -10,7 +10,7 @@
#include "trigger_structure.h"
void initializeNissanSR20VE_4(TriggerShape *s);
void initializeNissanSR20VE_4_360(TriggerShape *s);
void initializeNissanSR20VE_4(TriggerWaveform *s);
void initializeNissanSR20VE_4_360(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_NISSAN_H_ */

View File

@ -11,7 +11,7 @@
/**
* https://en.wikipedia.org/wiki/Rover_K-series_engine
*/
void initializeRoverK(TriggerShape *s) {
void initializeRoverK(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
float tooth = 20;

View File

@ -11,6 +11,6 @@
#include "trigger_structure.h"
void initializeRoverK(TriggerShape *s);
void initializeRoverK(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_ROVER_H_ */

View File

@ -47,7 +47,7 @@
EXTERN_ENGINE;
void event_trigger_position_s::setAngle(angle_t angle DECLARE_ENGINE_PARAMETER_SUFFIX) {
TRIGGER_SHAPE(findTriggerPosition(this, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
TRIGGER_WAVEFORM(findTriggerPosition(this, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
}
trigger_shape_helper::trigger_shape_helper() {
@ -57,7 +57,7 @@ trigger_shape_helper::trigger_shape_helper() {
}
}
TriggerShape::TriggerShape() :
TriggerWaveform::TriggerWaveform() :
wave(switchTimesBuffer, NULL) {
initialize(OM_NONE, false);
wave.channels = h.channels;
@ -65,7 +65,7 @@ TriggerShape::TriggerShape() :
memset(triggerIndexByAngle, 0, sizeof(triggerIndexByAngle));
}
void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTriggerInput) {
void TriggerWaveform::initialize(operation_mode_e operationMode, bool needSecondTriggerInput) {
isSynchronizationNeeded = true; // that's default value
bothFrontsRequired = false;
this->needSecondTriggerInput = needSecondTriggerInput;
@ -101,18 +101,18 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri
#endif
}
int TriggerShape::getSize() const {
int TriggerWaveform::getSize() const {
return privateTriggerDefinitionSize;
}
int TriggerShape::getTriggerShapeSynchPointIndex() const {
int TriggerWaveform::getTriggerWaveformSynchPointIndex() const {
return triggerShapeSynchPointIndex;
}
/**
* physical primary trigger duration
*/
angle_t TriggerShape::getCycleDuration() const {
angle_t TriggerWaveform::getCycleDuration() const {
switch (operationMode) {
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
return 180;
@ -128,7 +128,7 @@ angle_t TriggerShape::getCycleDuration() const {
* Trigger event count equals engine cycle event count if we have a cam sensor.
* Two trigger cycles make one engine cycle in case of a four stroke engine If we only have a cranksensor.
*/
uint32_t TriggerShape::getLength() const {
uint32_t TriggerWaveform::getLength() const {
/**
* 4 for FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
* 2 for FOUR_STROKE_CRANK_SENSOR
@ -138,7 +138,7 @@ uint32_t TriggerShape::getLength() const {
return multiplier * getSize();
}
angle_t TriggerShape::getAngle(int index) const {
angle_t TriggerWaveform::getAngle(int index) const {
// todo: why is this check here? looks like the code below could be used universally
if (operationMode == FOUR_STROKE_CAM_SENSOR) {
return getSwitchAngle(index);
@ -156,7 +156,7 @@ angle_t TriggerShape::getAngle(int index) const {
return getCycleDuration() * crankCycle + getSwitchAngle(remainder);
}
void TriggerShape::addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam, float filterLeft, float filterRight) {
void TriggerWaveform::addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam, float filterLeft, float filterRight) {
if (angle > filterLeft && angle < filterRight) {
#if EFI_UNIT_TEST
// printf("addEventClamped %f %s\r\n", angle, getTrigger_value_e(stateParam));
@ -165,7 +165,7 @@ void TriggerShape::addEventClamped(angle_t angle, trigger_wheel_e const channelI
}
}
operation_mode_e TriggerShape::getOperationMode() const {
operation_mode_e TriggerWaveform::getOperationMode() const {
return operationMode;
}
@ -173,7 +173,7 @@ operation_mode_e TriggerShape::getOperationMode() const {
extern bool printTriggerDebug;
#endif
void TriggerShape::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) {
UNUSED(useOnlyRisingEdgeForTrigger);
// todo: move the following logic from below here
// if (!useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
@ -182,11 +182,11 @@ void TriggerShape::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger
}
void TriggerShape::addEvent720(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam) {
void TriggerWaveform::addEvent720(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam) {
addEvent(angle / 720, channelIndex, stateParam);
}
void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam) {
void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam) {
efiAssertVoid(CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set");
efiAssertVoid(CUSTOM_ERR_6598, channelIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
@ -283,26 +283,26 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
wave.channels[channelIndex].setState(index, state);
}
angle_t TriggerShape::getSwitchAngle(int index) const {
angle_t TriggerWaveform::getSwitchAngle(int index) const {
return getCycleDuration() * wave.getSwitchTime(index);
}
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
void setToothedWheelConfiguration(TriggerWaveform *s, int total, int skipped,
operation_mode_e operationMode) {
#if EFI_ENGINE_CONTROL
s->useRiseEdge = true;
initializeSkippedToothTriggerShapeExt(s, total, skipped,
initializeSkippedToothTriggerWaveformExt(s, total, skipped,
operationMode);
#endif
}
void TriggerShape::setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
void TriggerWaveform::setTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
setTriggerSynchronizationGap3(/*gapIndex*/0, syncRatioFrom, syncRatioTo);
}
void TriggerShape::setTriggerSynchronizationGap3(int gapIndex, float syncRatioFrom, float syncRatioTo) {
void TriggerWaveform::setTriggerSynchronizationGap3(int gapIndex, float syncRatioFrom, float syncRatioTo) {
isSynchronizationNeeded = true;
this->syncronizationRatioFrom[gapIndex] = syncRatioFrom;
this->syncronizationRatioTo[gapIndex] = syncRatioTo;
@ -322,7 +322,7 @@ void TriggerShape::setTriggerSynchronizationGap3(int gapIndex, float syncRatioFr
/**
* this method is only used on initialization
*/
int TriggerShape::findAngleIndex(float target) const {
int TriggerWaveform::findAngleIndex(float target) const {
int engineCycleEventCount = getLength();
efiAssert(CUSTOM_ERR_ASSERT, engineCycleEventCount > 0, "engineCycleEventCount", 0);
@ -350,11 +350,11 @@ int TriggerShape::findAngleIndex(float target) const {
return left - 1;
}
void TriggerShape::setShapeDefinitionError(bool value) {
void TriggerWaveform::setShapeDefinitionError(bool value) {
shapeDefinitionError = value;
}
void TriggerShape::findTriggerPosition(event_trigger_position_s *position,
void TriggerWaveform::findTriggerPosition(event_trigger_position_s *position,
angle_t angle DEFINE_CONFIG_PARAM(angle_t, globalTriggerAngleOffset)) {
efiAssertVoid(CUSTOM_ERR_6574, !cisnan(angle), "findAngle#1");
assertAngleRange(angle, "findAngle#a1", CUSTOM_ERR_6545);
@ -381,7 +381,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position,
position->angleOffsetFromTriggerEvent = angle - triggerEventAngle;
}
void TriggerShape::prepareShape() {
void TriggerWaveform::prepareShape() {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
int engineCycleInt = (int) getEngineCycle(operationMode);
for (int angle = 0; angle < engineCycleInt; angle++) {
@ -395,19 +395,19 @@ void TriggerShape::prepareShape() {
#endif
}
void TriggerShape::setTriggerSynchronizationGap(float syncRatio) {
void TriggerWaveform::setTriggerSynchronizationGap(float syncRatio) {
setTriggerSynchronizationGap3(/*gapIndex*/0, syncRatio * 0.75f, syncRatio * 1.25f);
}
void TriggerShape::setSecondTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
void TriggerWaveform::setSecondTriggerSynchronizationGap2(float syncRatioFrom, float syncRatioTo) {
setTriggerSynchronizationGap3(/*gapIndex*/1, syncRatioFrom, syncRatioTo);
}
void TriggerShape::setThirdTriggerSynchronizationGap(float syncRatio) {
void TriggerWaveform::setThirdTriggerSynchronizationGap(float syncRatio) {
setTriggerSynchronizationGap3(/*gapIndex*/2, syncRatio * 0.75f, syncRatio * 1.25f);
}
void TriggerShape::setSecondTriggerSynchronizationGap(float syncRatio) {
void TriggerWaveform::setSecondTriggerSynchronizationGap(float syncRatio) {
setTriggerSynchronizationGap3(/*gapIndex*/1, syncRatio * 0.75f, syncRatio * 1.25f);
}
@ -415,11 +415,11 @@ void TriggerShape::setSecondTriggerSynchronizationGap(float syncRatio) {
/**
* External logger is needed because at this point our logger is not yet initialized
*/
void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e ambiguousOperationMode, bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig) {
void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_e ambiguousOperationMode, bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig) {
#if EFI_PROD_CODE
efiAssertVoid(CUSTOM_ERR_6641, getCurrentRemainingStack() > 256, "init t");
scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
scheduleMsg(logger, "initializeTriggerWaveform(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
#endif
shapeDefinitionError = false;
@ -429,7 +429,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e ambi
switch (triggerConfig->type) {
case TT_TOOTHED_WHEEL:
initializeSkippedToothTriggerShapeExt(this, triggerConfig->customTotalToothCount,
initializeSkippedToothTriggerWaveformExt(this, triggerConfig->customTotalToothCount,
triggerConfig->customSkippedToothCount, ambiguousOperationMode);
break;
@ -454,32 +454,32 @@ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e ambi
break;
case TT_DODGE_NEON_1995:
configureNeon1995TriggerShape(this);
configureNeon1995TriggerWaveform(this);
break;
case TT_DODGE_NEON_1995_ONLY_CRANK:
configureNeon1995TriggerShapeOnlyCrank(this);
configureNeon1995TriggerWaveformOnlyCrank(this);
break;
case TT_DODGE_STRATUS:
configureDodgeStratusTriggerShape(this);
configureDodgeStratusTriggerWaveform(this);
break;
case TT_DODGE_NEON_2003_CAM:
configureNeon2003TriggerShapeCam(this);
configureNeon2003TriggerWaveformCam(this);
break;
case TT_DODGE_NEON_2003_CRANK:
configureNeon2003TriggerShapeCam(this);
// configureNeon2003TriggerShapeCrank(triggerShape);
configureNeon2003TriggerWaveformCam(this);
// configureNeon2003TriggerWaveformCrank(triggerShape);
break;
case TT_FORD_ASPIRE:
configureFordAspireTriggerShape(this);
configureFordAspireTriggerWaveform(this);
break;
case TT_GM_7X:
configureGmTriggerShape(this);
configureGmTriggerWaveform(this);
break;
case TT_MAZDA_DOHC_1_4:
@ -507,7 +507,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e ambi
break;
case TT_MINI_COOPER_R50:
configureMiniCooperTriggerShape(this);
configureMiniCooperTriggerWaveform(this);
break;
case TT_TOOTHED_WHEEL_60_2:
@ -604,7 +604,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e ambi
default:
setShapeDefinitionError(true);
warning(CUSTOM_ERR_NO_SHAPE, "initializeTriggerShape() not implemented: %d", triggerConfig->type);
warning(CUSTOM_ERR_NO_SHAPE, "initializeTriggerWaveform() not implemented: %d", triggerConfig->type);
}
/**
* Feb 2019 suggestion: it would be an improvement to remove 'expectedEventCount' logic from 'addEvent'

View File

@ -72,10 +72,10 @@ class TriggerState;
* @brief Trigger shape has all the fields needed to describe and decode trigger signal.
* @see TriggerState for trigger decoder state which works based on this trigger shape model
*/
class TriggerShape {
class TriggerWaveform {
public:
TriggerShape();
void initializeTriggerShape(Logging *logger, operation_mode_e ambiguousOperationMode,
TriggerWaveform();
void initializeTriggerWaveform(Logging *logger, operation_mode_e ambiguousOperationMode,
bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig);
void findTriggerPosition(event_trigger_position_s *position,
angle_t angle DEFINE_CONFIG_PARAM(angle_t, globalTriggerAngleOffset));
@ -240,7 +240,7 @@ public:
uint32_t getLength() const;
int getSize() const;
int getTriggerShapeSynchPointIndex() const;
int getTriggerWaveformSynchPointIndex() const;
void prepareShape();
/**
@ -250,7 +250,7 @@ public:
angle_t getAngle(int phaseIndex) const;
/**
* index of synchronization event within TriggerShape
* index of synchronization event within TriggerWaveform
* See findTriggerZeroEventIndex()
*/
int triggerShapeSynchPointIndex;
@ -283,8 +283,8 @@ private:
angle_t getCycleDuration() const;
};
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped, operation_mode_e operationMode);
void setToothedWheelConfiguration(TriggerWaveform *s, int total, int skipped, operation_mode_e operationMode);
#define TRIGGER_SHAPE(x) ENGINE(triggerCentral.triggerShape.x)
#define TRIGGER_WAVEFORM(x) ENGINE(triggerCentral.triggerShape.x)
#define getTriggerSize() TRIGGER_SHAPE(privateTriggerDefinitionSize)
#define getTriggerSize() TRIGGER_WAVEFORM(privateTriggerDefinitionSize)

View File

@ -10,7 +10,7 @@
/**
* This trigger is also used by Nissan and Mazda
*/
void initialize36_2_2_2(TriggerShape *s) {
void initialize36_2_2_2(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
float wide = 30 * 2;
@ -46,7 +46,7 @@ void initialize36_2_2_2(TriggerShape *s) {
s->useOnlyPrimaryForSync = true;
}
void initializeSubaru7_6(TriggerShape *s) {
void initializeSubaru7_6(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
float magic = 333;

View File

@ -10,7 +10,7 @@
#include "trigger_structure.h"
void initialize36_2_2_2(TriggerShape *s);
void initializeSubaru7_6(TriggerShape *s);
void initialize36_2_2_2(TriggerWaveform *s);
void initializeSubaru7_6(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_SUBARU_H_ */

View File

@ -9,7 +9,7 @@
#include "trigger_toyota.h"
void initialize2jzGE1_12(TriggerShape *s) {
void initialize2jzGE1_12(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
float crankD = 360 / 12 / 2; // 15
@ -43,7 +43,7 @@ void initialize2jzGE1_12(TriggerShape *s) {
s->isSynchronizationNeeded = false;
}
void initialize2jzGE3_34(TriggerShape *s) {
void initialize2jzGE3_34(TriggerWaveform *s) {
setToothedWheelConfiguration(s, 36, 2, FOUR_STROKE_CRANK_SENSOR);
// s->initialize(FOUR_STROKE_CAM_SENSOR, true);

View File

@ -10,7 +10,7 @@
#include "trigger_structure.h"
void initialize2jzGE1_12(TriggerShape *s);
void initialize2jzGE3_34(TriggerShape *s);
void initialize2jzGE1_12(TriggerWaveform *s);
void initialize2jzGE3_34(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_TRIGGER_TOYOTA_H_ */

View File

@ -11,7 +11,7 @@ angle_t getEngineCycle(operation_mode_e operationMode) {
return operationMode == TWO_STROKE ? 360 : FOUR_STROKE_ENGINE_CYCLE;
}
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int totalTeethCount, int skippedCount,
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount,
float toothWidth, float offset, float engineCycle, float filterLeft, float filterRight) {
efiAssertVoid(CUSTOM_ERR_6586, totalTeethCount > 0, "total count");
efiAssertVoid(CUSTOM_ERR_6587, skippedCount >= 0, "skipped count");
@ -28,14 +28,14 @@ void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int to
s->addEventClamped(offset + engineCycle, wheel, TV_FALL, filterLeft, filterRight);
}
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
void initializeSkippedToothTriggerWaveformExt(TriggerWaveform *s, int totalTeethCount, int skippedCount,
operation_mode_e operationMode) {
if (totalTeethCount <= 0) {
warning(CUSTOM_OBD_TRIGGER_SHAPE, "totalTeethCount is zero or less: %d", totalTeethCount);
warning(CUSTOM_OBD_TRIGGER_WAVEFORM, "totalTeethCount is zero or less: %d", totalTeethCount);
s->setShapeDefinitionError(true);
return;
}
efiAssertVoid(CUSTOM_NULL_SHAPE, s != NULL, "TriggerShape is NULL");
efiAssertVoid(CUSTOM_NULL_SHAPE, s != NULL, "TriggerWaveform is NULL");
s->initialize(operationMode, false);
s->setTriggerSynchronizationGap(skippedCount + 1);
@ -46,7 +46,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
}
void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
void configureOnePlusOne(TriggerWaveform *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
@ -60,7 +60,7 @@ void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
s->useOnlyPrimaryForSync = true;
}
void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) {
void configureOnePlus60_2(TriggerWaveform *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
@ -79,7 +79,7 @@ void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode) {
s->useOnlyPrimaryForSync = true;
}
void configure3_1_cam(TriggerShape *s, operation_mode_e operationMode) {
void configure3_1_cam(TriggerWaveform *s, operation_mode_e operationMode) {
UNUSED(operationMode);
s->initialize(FOUR_STROKE_CAM_SENSOR, true);

View File

@ -14,17 +14,17 @@
#define NO_LEFT_FILTER -1
#define NO_RIGHT_FILTER 1000
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s,
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerWaveform *s,
int totalTeethCount, int skippedCount,
float toothWidth,
float offset, float engineCycle, float filterLeft, float filterRight);
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode);;
void initializeSkippedToothTriggerWaveformExt(TriggerWaveform *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode);;
void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode);
void configureOnePlus60_2(TriggerWaveform *s, operation_mode_e operationMode);
void configure3_1_cam(TriggerShape *s, operation_mode_e operationMode);
void configure3_1_cam(TriggerWaveform *s, operation_mode_e operationMode);
void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode);
void configureOnePlusOne(TriggerWaveform *s, operation_mode_e operationMode);
#endif /* CONTROLLERS_TRIGGER_DECODERS_TRIGGER_UNIVERSAL_H_ */

View File

@ -8,8 +8,8 @@
#include "trigger_vw.h"
#include "trigger_universal.h"
void setVwConfiguration(TriggerShape *s) {
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerShape is NULL");
void setVwConfiguration(TriggerWaveform *s) {
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerWaveform is NULL");
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);

View File

@ -10,6 +10,6 @@
#include "trigger_structure.h"
void setVwConfiguration(TriggerShape *s);
void setVwConfiguration(TriggerWaveform *s);
#endif /* CONTROLLERS_TRIGGER_DECODERS_TRIGGER_VW_H_ */

View File

@ -497,7 +497,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
engine->ignitionEvents.isReady = false; // we need to rebuild complete ignition schedule
engine->injectionEvents.isReady = false;
// moved 'triggerIndexByAngle' into trigger initialization (why was it invoked from here if it's only about trigger shape & optimization?)
// see initializeTriggerShape() -> prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE)
// see initializeTriggerWaveform() -> prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE)
// we need this to apply new 'triggerIndexByAngle' values
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -290,12 +290,12 @@ bool TriggerCentral::noiseFilter(efitick_t nowNt, trigger_event_e signal DECLARE
efitick_t allowedPeriod = accumSignalPrevPeriods[os];
// but first check if we're expecting a gap
bool isGapExpected = TRIGGER_SHAPE(isSynchronizationNeeded) && triggerState.shaft_is_synchronized &&
(triggerState.currentCycle.eventCount[ti] + 1) == TRIGGER_SHAPE(expectedEventCount[ti]);
bool isGapExpected = TRIGGER_WAVEFORM(isSynchronizationNeeded) && triggerState.shaft_is_synchronized &&
(triggerState.currentCycle.eventCount[ti] + 1) == TRIGGER_WAVEFORM(expectedEventCount[ti]);
if (isGapExpected) {
// usually we need to extend the period for gaps, based on the trigger info
allowedPeriod *= TRIGGER_SHAPE(syncRatioAvg);
allowedPeriod *= TRIGGER_WAVEFORM(syncRatioAvg);
}
// also we need some margin for rapidly changing trigger-wheel speed,
@ -430,9 +430,9 @@ EXTERN_ENGINE
static void triggerShapeInfo(void) {
#if EFI_PROD_CODE || EFI_SIMULATOR
TriggerShape *s = &engine->triggerCentral.triggerShape;
scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_SHAPE(useRiseEdge)));
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_WAVEFORM(useRiseEdge)));
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_WAVEFORM(syncronizationRatioFrom[0]), TRIGGER_WAVEFORM(syncronizationRatioTo[0]));
for (int i = 0; i < s->getSize(); i++) {
scheduleMsg(logger, "event %d %.2f", i, s->eventAngles[i]);
@ -474,8 +474,8 @@ void printAllTriggers() {
engineConfiguration->trigger.type = tt;
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
TriggerShape *s = &engine->triggerCentral.triggerShape;
engine->eInitializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
engine->initializeTriggerWaveform(NULL PASS_ENGINE_PARAMETER_SUFFIX);
if (s->shapeDefinitionError) {
printf("Trigger error %d\r\n", triggerId);
@ -488,7 +488,7 @@ void printAllTriggers() {
for (int i = 0; i < s->getLength(); i++) {
int triggerDefinitionCoordinate = (s->getTriggerShapeSynchPointIndex() + i) % s->getSize();
int triggerDefinitionCoordinate = (s->getTriggerWaveformSynchPointIndex() + i) % s->getSize();
fprintf(fp, "event %d %d %.2f\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
@ -546,7 +546,7 @@ extern int icuWidthPeriodCounter;
void triggerInfo(void) {
#if EFI_PROD_CODE || EFI_SIMULATOR
TriggerShape *ts = &engine->triggerCentral.triggerShape;
TriggerWaveform *ts = &engine->triggerCentral.triggerShape;
#if (HAL_TRIGGER_USE_PAL == TRUE) && (PAL_USE_CALLBACKS == TRUE)
@ -562,8 +562,8 @@ void triggerInfo(void) {
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s useOnlyFirstChannel=%s tdcOffset=%.2f",
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger),
boolToString(engineConfiguration->trigger.useOnlyFirstChannel), TRIGGER_SHAPE(tdcPosition));
boolToString(TRIGGER_WAVEFORM(useRiseEdge)), boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger),
boolToString(engineConfiguration->trigger.useOnlyFirstChannel), TRIGGER_WAVEFORM(tdcPosition));
if (engineConfiguration->trigger.type == TT_TOOTHED_WHEEL) {
scheduleMsg(logger, "total %d/skipped %d", engineConfiguration->trigger.customTotalToothCount,
@ -577,12 +577,12 @@ void triggerInfo(void) {
scheduleMsg(logger, "trigger#2 event counters up=%d/down=%d", engine->triggerCentral.getHwEventCounter(2),
engine->triggerCentral.getHwEventCounter(3));
}
scheduleMsg(logger, "expected cycle events %d/%d/%d", TRIGGER_SHAPE(expectedEventCount[0]),
TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]));
scheduleMsg(logger, "expected cycle events %d/%d/%d", TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]), TRIGGER_WAVEFORM(expectedEventCount[2]));
scheduleMsg(logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->trigger.type,
boolToString(TRIGGER_SHAPE(needSecondTriggerInput)));
scheduleMsg(logger, "expected duty #0=%.2f/#1=%.2f", TRIGGER_SHAPE(expectedDutyCycle[0]), TRIGGER_SHAPE(expectedDutyCycle[1]));
boolToString(TRIGGER_WAVEFORM(needSecondTriggerInput)));
scheduleMsg(logger, "expected duty #0=%.2f/#1=%.2f", TRIGGER_WAVEFORM(expectedDutyCycle[0]), TRIGGER_WAVEFORM(expectedDutyCycle[1]));
scheduleMsg(logger, "synchronizationNeeded=%s/isError=%s/total errors=%d ord_err=%d/total revolutions=%d/self=%s",
boolToString(ts->isSynchronizationNeeded),
@ -590,8 +590,8 @@ void triggerInfo(void) {
engine->triggerCentral.triggerState.orderingErrorCounter, engine->triggerCentral.triggerState.getTotalRevolutionCounter(),
boolToString(engineConfiguration->directSelfStimulation));
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
if (TRIGGER_WAVEFORM(isSynchronizationNeeded)) {
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_WAVEFORM(syncronizationRatioFrom[0]), TRIGGER_WAVEFORM(syncronizationRatioTo[0]));
}
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
@ -699,7 +699,7 @@ void onConfigurationChangeTriggerCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
assertEngineReference();
#if EFI_ENGINE_CONTROL
ENGINE(eInitializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
ENGINE(initializeTriggerWaveform(logger PASS_ENGINE_PARAMETER_SUFFIX));
engine->triggerCentral.resetAccumSignalData();
#endif
}

View File

@ -41,7 +41,7 @@ public:
*/
efitick_t timeAtVirtualZeroNt = 0;
TriggerShape triggerShape;
TriggerWaveform triggerShape;
efitick_t previousVvtCamTime = 0;
efitick_t previousVvtCamDuration = 0;

View File

@ -120,7 +120,7 @@ bool isTriggerDecoderError(void) {
return errorDetection.sum(6) > 4;
}
void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
void calculateTriggerSynchPoint(TriggerWaveform *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE
efiAssertVoid(CUSTOM_ERR_6642, getCurrentRemainingStack() > 256, "calc s");
#endif
@ -132,7 +132,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
engine->engineCycleEventCount = length;
efiAssertVoid(CUSTOM_SHAPE_LEN_ZERO, length > 0, "shapeLength=0");
if (length >= PWM_PHASE_MAX_COUNT) {
warning(CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG, "Count above %d", length);
warning(CUSTOM_ERR_TRIGGER_WAVEFORM_TOO_LONG, "Count above %d", length);
shape->setShapeDefinitionError(true);
return;
}
@ -194,7 +194,7 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndexOut,
/**
* Here we calculate RPM based on last 90 degrees
*/
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[current_index]);
angle_t currentAngle = TRIGGER_WAVEFORM(eventAngles[current_index]);
// todo: make this '90' depend on cylinder count or trigger shape?
if (cisnan(currentAngle)) {
return NOISY_RPM;
@ -202,14 +202,14 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndexOut,
angle_t previousAngle = currentAngle - 90;
fixAngle(previousAngle, "prevAngle", CUSTOM_ERR_TRIGGER_ANGLE_RANGE);
// todo: prevIndex should be pre-calculated
int prevIndex = TRIGGER_SHAPE(triggerIndexByAngle[(int)previousAngle]);
int prevIndex = TRIGGER_WAVEFORM(triggerIndexByAngle[(int)previousAngle]);
if (prevIndexOut != NULL) {
*prevIndexOut = prevIndex;
}
// now let's get precise angle for that event
angle_t prevIndexAngle = TRIGGER_SHAPE(eventAngles[prevIndex]);
angle_t prevIndexAngle = TRIGGER_WAVEFORM(eventAngles[prevIndex]);
efitick_t time90ago = timeOfLastEvent[prevIndex];
if (time90ago == 0) {
return prevInstantRpmValue;
@ -259,7 +259,7 @@ void TriggerStateWithRunningStatistics::runtimeStatistics(efitime_t nowNt DECLAR
instantRpm = calculateInstantRpm(&prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
#if EFI_SENSOR_CHART
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
angle_t currentAngle = TRIGGER_WAVEFORM(eventAngles[currentCycle.current_index]);
if (CONFIGB(sensorChartMode) == SC_DETAILED_RPM) {
scAddData(currentAngle, instantRpm);
} else {
@ -303,10 +303,10 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F
PRINT_INC_INDEX; \
}
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
#define considerEventForGap() (!TRIGGER_WAVEFORM(useOnlyPrimaryForSync) || isPrimary)
#define needToSkipFall(type) ((!TRIGGER_SHAPE(gapBothDirections)) && (( TRIGGER_SHAPE(useRiseEdge)) && (type != TV_RISE)))
#define needToSkipRise(type) ((!TRIGGER_SHAPE(gapBothDirections)) && ((!TRIGGER_SHAPE(useRiseEdge)) && (type != TV_FALL)))
#define needToSkipFall(type) ((!TRIGGER_WAVEFORM(gapBothDirections)) && (( TRIGGER_WAVEFORM(useRiseEdge)) && (type != TV_RISE)))
#define needToSkipRise(type) ((!TRIGGER_WAVEFORM(gapBothDirections)) && ((!TRIGGER_WAVEFORM(useRiseEdge)) && (type != TV_FALL)))
int TriggerState::getCurrentIndex() const {
return currentCycle.current_index;
@ -338,16 +338,16 @@ void TriggerState::onSynchronizationLost(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
bool TriggerState::validateEventCounters(DECLARE_ENGINE_PARAMETER_SIGNATURE) const {
bool isDecodingError = currentCycle.eventCount[0] != TRIGGER_SHAPE(expectedEventCount[0])
|| currentCycle.eventCount[1] != TRIGGER_SHAPE(expectedEventCount[1])
|| currentCycle.eventCount[2] != TRIGGER_SHAPE(expectedEventCount[2]);
bool isDecodingError = currentCycle.eventCount[0] != TRIGGER_WAVEFORM(expectedEventCount[0])
|| currentCycle.eventCount[1] != TRIGGER_WAVEFORM(expectedEventCount[1])
|| currentCycle.eventCount[2] != TRIGGER_WAVEFORM(expectedEventCount[2]);
#if EFI_UNIT_TEST
printf("sync point: isDecodingError=%d\r\n", isDecodingError);
if (isDecodingError) {
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[0], TRIGGER_SHAPE(expectedEventCount[0]));
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[1], TRIGGER_SHAPE(expectedEventCount[1]));
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[2], TRIGGER_SHAPE(expectedEventCount[2]));
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[0], TRIGGER_WAVEFORM(expectedEventCount[0]));
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[1], TRIGGER_WAVEFORM(expectedEventCount[1]));
printf("count: cur=%d exp=%d\r\n", currentCycle.eventCount[2], TRIGGER_WAVEFORM(expectedEventCount[2]));
}
#endif /* EFI_UNIT_TEST */
@ -367,9 +367,9 @@ void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
currentCycle.eventCount[0],
currentCycle.eventCount[1],
currentCycle.eventCount[2],
TRIGGER_SHAPE(expectedEventCount[0]),
TRIGGER_SHAPE(expectedEventCount[1]),
TRIGGER_SHAPE(expectedEventCount[2]));
TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]),
TRIGGER_WAVEFORM(expectedEventCount[2]));
lastDecodingErrorTime = getTimeNowNt();
someSortOfTriggerError = true;
@ -377,8 +377,8 @@ void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIG(verboseTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) {
#if EFI_PROD_CODE
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]),
TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]),
currentCycle.current_index, TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]), TRIGGER_WAVEFORM(expectedEventCount[2]),
currentCycle.eventCount[0], currentCycle.eventCount[1], currentCycle.eventCount[2]);
#endif /* EFI_PROD_CODE */
}
@ -422,8 +422,8 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
ScopePerf perf(PE::DecodeTriggerEvent, static_cast<uint8_t>(signal));
bool useOnlyRisingEdgeForTrigger = CONFIG(useOnlyRisingEdgeForTrigger);
// todo: use 'triggerShape' instead of TRIGGER_SHAPE in order to decouple this method from engine #635
TriggerShape *triggerShape = &ENGINE(triggerCentral.triggerShape);
// todo: use 'triggerShape' instead of TRIGGER_WAVEFORM in order to decouple this method from engine #635
TriggerWaveform *triggerShape = &ENGINE(triggerCentral.triggerShape);
efiAssertVoid(CUSTOM_ERR_6640, signal <= SHAFT_3RD_RISING, "unexpected signal");
@ -536,7 +536,7 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
bool isSync = true;
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
bool isGapCondition = cisnan(triggerShape->syncronizationRatioFrom[i]) || (toothDurations[i] > toothDurations[i + 1] * TRIGGER_SHAPE(syncronizationRatioFrom[i])
bool isGapCondition = cisnan(triggerShape->syncronizationRatioFrom[i]) || (toothDurations[i] > toothDurations[i + 1] * TRIGGER_WAVEFORM(syncronizationRatioFrom[i])
&& toothDurations[i] < toothDurations[i + 1] * triggerShape->syncronizationRatioTo[i]);
isSync &= isGapCondition;
@ -571,8 +571,8 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
/* cast is needed to make sure we do not put 64 bit value to stack*/ (int)getTimeNowSeconds(),
i,
gap,
TRIGGER_SHAPE(syncronizationRatioFrom[i]),
TRIGGER_SHAPE(syncronizationRatioTo[i]),
TRIGGER_WAVEFORM(syncronizationRatioFrom[i]),
TRIGGER_WAVEFORM(syncronizationRatioTo[i]),
boolToString(someSortOfTriggerError));
}
}
@ -585,8 +585,8 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
print("index=%d: gap=%.2f expected from %.2f to %.2f error=%s\r\n",
i,
gap,
TRIGGER_SHAPE(syncronizationRatioFrom[i]),
TRIGGER_SHAPE(syncronizationRatioTo[i]),
TRIGGER_WAVEFORM(syncronizationRatioFrom[i]),
TRIGGER_WAVEFORM(syncronizationRatioTo[i]),
boolToString(someSortOfTriggerError));
}
}
@ -659,8 +659,8 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
if (isTriggerDecoderError()) {
warning(CUSTOM_OBD_TRG_DECODING, "trigger decoding issue. expected %d/%d/%d got %d/%d/%d",
TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]),
TRIGGER_SHAPE(expectedEventCount[2]), currentCycle.eventCount[0], currentCycle.eventCount[1],
TRIGGER_WAVEFORM(expectedEventCount[0]), TRIGGER_WAVEFORM(expectedEventCount[1]),
TRIGGER_WAVEFORM(expectedEventCount[2]), currentCycle.eventCount[0], currentCycle.eventCount[1],
currentCycle.eventCount[2]);
}
}
@ -711,9 +711,9 @@ static void onFindIndexCallback(TriggerState *state) {
* Trigger shape is defined in a way which is convenient for trigger shape definition
* On the other hand, trigger decoder indexing begins from synchronization event.
*
* This function finds the index of synchronization event within TriggerShape
* This function finds the index of synchronization event within TriggerWaveform
*/
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape,
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
UNUSED(triggerConfig);
#if EFI_PROD_CODE

View File

@ -30,7 +30,7 @@ typedef struct {
/**
* Number of actual events of each channel within current trigger cycle, these
* values are used to detect trigger signal errors.
* see TriggerShape
* see TriggerWaveform
*/
uint32_t eventCount[PWM_PHASE_MAX_WAVE_PER_PWM];
/**
@ -48,7 +48,7 @@ typedef struct {
} current_cycle_state_s;
/**
* @see TriggerShape for trigger wheel shape definition
* @see TriggerWaveform for trigger wheel shape definition
*/
class TriggerState : public trigger_state_s {
public:
@ -170,7 +170,7 @@ public:
};
angle_t getEngineCycle(operation_mode_e operationMode);
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerWaveform * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
class Engine;
@ -179,5 +179,5 @@ void initTriggerDecoderLogger(Logging *sharedLogger);
bool isTriggerDecoderError(void);
void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX);
void calculateTriggerSynchPoint(TriggerWaveform *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -2,7 +2,7 @@
* @file trigger_emulator_algo.cpp
*
* This file is about producing real electrical signals which emulate trigger signal based on
* a known TriggerShape.
* a known TriggerWaveform.
*
* Historically this implementation was implemented based on PwmConfig which is maybe not the
* best way to implement it. (todo: why is not the best way?)
@ -115,14 +115,14 @@ void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
scheduleMsg(logger, "Emulating position sensor(s). RPM=%d", rpm);
}
static void updateTriggerShapeIfNeeded(PwmConfig *state) {
static void updateTriggerWaveformIfNeeded(PwmConfig *state) {
if (atTriggerVersion < engine->triggerCentral.triggerShape.version) {
atTriggerVersion = engine->triggerCentral.triggerShape.version;
scheduleMsg(logger, "Stimulator: updating trigger shape: %d/%d %d", atTriggerVersion,
engine->getGlobalConfigurationVersion(), currentTimeMillis());
TriggerShape *s = &engine->triggerCentral.triggerShape;
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = {
s->wave.channels[0].pinStates,
s->wave.channels[1].pinStates,
@ -164,7 +164,7 @@ static void resumeStimulator() {
void initTriggerEmulatorLogic(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
TriggerShape *s = &engine->triggerCentral.triggerShape;
TriggerWaveform *s = &engine->triggerCentral.triggerShape;
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency PASS_ENGINE_PARAMETER_SUFFIX);
pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = {
s->wave.channels[0].pinStates,
@ -173,7 +173,7 @@ void initTriggerEmulatorLogic(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUF
triggerSignal.weComplexInit("position sensor",
&engine->executor,
s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
pinStates, updateTriggerShapeIfNeeded, (pwm_gen_callback*)emulatorApplyPinState);
pinStates, updateTriggerWaveformIfNeeded, (pwm_gen_callback*)emulatorApplyPinState);
addConsoleActionI("rpm", setTriggerEmulatorRPM);
addConsoleActionI("stop_stimulator_at_index", setEmulatorAtIndex);

View File

@ -27,7 +27,7 @@ extern bool printTriggerDebug;
#endif /* ! EFI_UNIT_TEST */
void TriggerStimulatorHelper::feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback,
TriggerState *state, TriggerShape * shape, int i
TriggerState *state, TriggerWaveform * shape, int i
DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(CUSTOM_ERR_6593, shape->getSize() > 0, "size not zero");
int stateIndex = i % shape->getSize();
@ -92,7 +92,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(const TriggerStateCallback trig
}
void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(const TriggerStateCallback triggerCycleCallback,
const uint32_t syncIndex, TriggerState *state, TriggerShape * shape
const uint32_t syncIndex, TriggerState *state, TriggerWaveform * shape
DECLARE_ENGINE_PARAMETER_SUFFIX) {
/**
@ -103,7 +103,7 @@ void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(const TriggerSta
}
int revolutionCounter = state->getTotalRevolutionCounter();
if (revolutionCounter != GAP_TRACKING_LENGTH + 1) {
warning(CUSTOM_OBD_TRIGGER_SHAPE, "sync failed/wrong gap parameters trigger=%s rc=%d", getTrigger_type_e(engineConfiguration->trigger.type), revolutionCounter);
warning(CUSTOM_OBD_TRIGGER_WAVEFORM, "sync failed/wrong gap parameters trigger=%s rc=%d", getTrigger_type_e(engineConfiguration->trigger.type), revolutionCounter);
shape->setShapeDefinitionError(true);
return;
}
@ -117,7 +117,7 @@ void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(const TriggerSta
/**
* @return trigger synchronization point index, or error code if not found
*/
uint32_t TriggerStimulatorHelper::findTriggerSyncPoint(TriggerShape * shape,
uint32_t TriggerStimulatorHelper::findTriggerSyncPoint(TriggerWaveform * shape,
TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
for (int i = 0; i < 4 * PWM_PHASE_MAX_COUNT; i++) {
feedSimulatedEvent(nullptr, state, shape, i PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -13,16 +13,16 @@
class TriggerStimulatorHelper {
public:
uint32_t findTriggerSyncPoint(TriggerShape * shape,
uint32_t findTriggerSyncPoint(TriggerWaveform * shape,
TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX);
void assertSyncPositionAndSetDutyCycle(const TriggerStateCallback triggerCycleCallback,
const uint32_t index, TriggerState *state, TriggerShape * shape
const uint32_t index, TriggerState *state, TriggerWaveform * shape
DECLARE_ENGINE_PARAMETER_SUFFIX);
private:
// send next event so that we can see how state reacts
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback, TriggerState *state, TriggerShape * shape, int i DECLARE_ENGINE_PARAMETER_SUFFIX);
void feedSimulatedEvent(const TriggerStateCallback triggerCycleCallback, TriggerState *state, TriggerWaveform * shape, int i DECLARE_ENGINE_PARAMETER_SUFFIX);
};
bool isUsefulSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -57,7 +57,7 @@ static void setHysteresis(COMPDriver *comp, int sign) {
static void comp_shaft_callback(COMPDriver *comp) {
uint32_t status = comp_lld_get_status(comp);
int isPrimary = (comp == EFI_COMP_PRIMARY_DEVICE);
if (!isPrimary && !TRIGGER_SHAPE(needSecondTriggerInput)) {
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
return;
}
trigger_event_e signal;

View File

@ -32,7 +32,7 @@ static void shaft_callback(void *arg) {
return;
bool isPrimary = pal_line == primary_line;
if (!isPrimary && !TRIGGER_SHAPE(needSecondTriggerInput)) {
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
return;
}

View File

@ -51,7 +51,7 @@ static void shaftWidthCallback(bool isPrimary) {
// todo: start using real event time from HW event, not just software timer?
if (hasFirmwareErrorFlag)
return;
if (!isPrimary && !TRIGGER_SHAPE(needSecondTriggerInput)) {
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
return;
}
// icucnt_t last_width = icuGetWidth(icup); so far we are fine with system time
@ -68,7 +68,7 @@ static void shaftPeriodCallback(bool isPrimary) {
icuWidthPeriodCounter++;
if (hasFirmwareErrorFlag)
return;
if (!isPrimary && !TRIGGER_SHAPE(needSecondTriggerInput)) {
if (!isPrimary && !TRIGGER_WAVEFORM(needSecondTriggerInput)) {
return;
}

View File

@ -75,7 +75,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
//todo: reuse initPeriodicEvents(PASS_ENGINE_PARAMETER_SIGNATURE) method
engine->periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->eInitializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
engine->initializeTriggerWaveform(NULL PASS_ENGINE_PARAMETER_SUFFIX);
initRpmCalculator(NULL PASS_ENGINE_PARAMETER_SUFFIX);
initMainEventListener(NULL PASS_ENGINE_PARAMETER_SUFFIX);
}
@ -214,11 +214,11 @@ void EngineTestHelper::assertEvent(const char *msg, int index, void *callback, e
}
void EngineTestHelper::applyTriggerShape() {
void EngineTestHelper::applyTriggerWaveform() {
Engine *engine = &this->engine;
EXPAND_Engine
ENGINE(eInitializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX));
ENGINE(initializeTriggerWaveform(NULL PASS_ENGINE_PARAMETER_SUFFIX));
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
@ -261,7 +261,7 @@ void EngineTestHelper::setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARA
engineConfiguration->trigger.type = trigger;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
ASSERT_EQ( 1, isTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #2";
applyTriggerShape();
applyTriggerWaveform();
}
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injectionMode) {

View File

@ -28,7 +28,7 @@ class EngineTestHelper : public EngineTestHelperBase {
public:
EngineTestHelper(engine_type_e engineType);
EngineTestHelper(engine_type_e engineType, configuration_callback_t boardCallback);
void applyTriggerShape();
void applyTriggerWaveform();
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
void fireRise(float delayMs);
void fireFall(float delayMs);

View File

@ -114,7 +114,7 @@ TEST(misc, testFuelMap) {
}
static void confgiureFordAspireTriggerShape(TriggerShape * s) {
static void confgiureFordAspireTriggerWaveform(TriggerWaveform * s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, true);
s->addEvent720(53.747, T_SECONDARY, TV_RISE);
@ -163,52 +163,52 @@ TEST(misc, testAngleResolver) {
engineConfiguration->globalTriggerAngleOffset = 175;
TriggerShape * ts = &engine->triggerCentral.triggerShape;
engine->eInitializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
TriggerWaveform * ts = &engine->triggerCentral.triggerShape;
engine->initializeTriggerWaveform(NULL PASS_ENGINE_PARAMETER_SUFFIX);
assertEqualsM("index 2", 52.76, ts->eventAngles[3]); // this angle is relation to synch point
assertEqualsM("time 2", 0.3233, ts->wave.getSwitchTime(2));
assertEqualsM("index 5", 412.76, ts->eventAngles[6]);
assertEqualsM("time 5", 0.5733, ts->wave.getSwitchTime(5));
ASSERT_EQ(4, ts->getTriggerShapeSynchPointIndex());
ASSERT_EQ(4, ts->getTriggerWaveformSynchPointIndex());
ASSERT_EQ( 10, ts->getSize()) << "shape size";
event_trigger_position_s injectionStart;
printf("*************************************************** testAngleResolver 0\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -122, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, -122, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
ASSERT_NEAR(0.24, injectionStart.angleOffsetFromTriggerEvent, EPS5D);
printf("*************************************************** testAngleResolver 0.1\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -80, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, -80, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
ASSERT_FLOAT_EQ(42.24, injectionStart.angleOffsetFromTriggerEvent);
printf("*************************************************** testAngleResolver 0.2\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -54, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, -54, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ( 2, injectionStart.triggerEventIndex) << "eventIndex@0";
ASSERT_FLOAT_EQ(68.2400, injectionStart.angleOffsetFromTriggerEvent);
printf("*************************************************** testAngleResolver 0.3\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -53, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, -53, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ(2, injectionStart.triggerEventIndex);
ASSERT_FLOAT_EQ(69.24, injectionStart.angleOffsetFromTriggerEvent);
printf("*************************************************** testAngleResolver 1\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 0, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, 0, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ(2, injectionStart.triggerEventIndex);
ASSERT_FLOAT_EQ(122.24, injectionStart.angleOffsetFromTriggerEvent);
printf("*************************************************** testAngleResolver 2\r\n");
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, 56, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&injectionStart, 56, engineConfiguration->globalTriggerAngleOffset));
ASSERT_EQ(2, injectionStart.triggerEventIndex);
ASSERT_FLOAT_EQ(178.24, injectionStart.angleOffsetFromTriggerEvent);
TriggerShape t;
confgiureFordAspireTriggerShape(&t);
TriggerWaveform t;
confgiureFordAspireTriggerWaveform(&t);
}
TEST(misc, testPinHelper) {

View File

@ -13,7 +13,7 @@ TEST(big, testSpeedDensity) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
engineConfiguration->trigger.customTotalToothCount = 8;
eth.applyTriggerShape();
eth.applyTriggerWaveform();
eth.fireTriggerEvents(36);
ASSERT_EQ( 1500, GET_RPM()) << "RPM";

View File

@ -49,7 +49,7 @@ static int getTriggerZeroEventIndex(engine_type_e engineType) {
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
TriggerShape * shape = &eth.engine.triggerCentral.triggerShape;
TriggerWaveform * shape = &eth.engine.triggerCentral.triggerShape;
return findTriggerZeroEventIndex(&eth.engine.triggerCentral.triggerState, shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER_SUFFIX);
}
@ -60,8 +60,8 @@ static void testDodgeNeonDecoder(void) {
WITH_ENGINE_TEST_HELPER(DODGE_NEON_1995);
TriggerShape * shape = &eth.engine.triggerCentral.triggerShape;
ASSERT_EQ(8, shape->getTriggerShapeSynchPointIndex());
TriggerWaveform * shape = &eth.engine.triggerCentral.triggerShape;
ASSERT_EQ(8, shape->getTriggerWaveformSynchPointIndex());
TriggerState state;
@ -151,22 +151,22 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
TriggerShape * shape = &engine->triggerCentral.triggerShape;
TriggerWaveform * shape = &engine->triggerCentral.triggerShape;
ASSERT_EQ( 0, shape->getTriggerShapeSynchPointIndex()) << "triggerShapeSynchPointIndex";
ASSERT_EQ( 0, shape->getTriggerWaveformSynchPointIndex()) << "triggerShapeSynchPointIndex";
event_trigger_position_s position;
ASSERT_EQ( 0, engineConfiguration->globalTriggerAngleOffset) << "globalTriggerAngleOffset";
TRIGGER_SHAPE(findTriggerPosition(&position, 0, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&position, 0, engineConfiguration->globalTriggerAngleOffset));
assertTriggerPosition(&position, 0, 0);
TRIGGER_SHAPE(findTriggerPosition(&position, 200, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&position, 200, engineConfiguration->globalTriggerAngleOffset));
assertTriggerPosition(&position, 3, 20);
TRIGGER_SHAPE(findTriggerPosition(&position, 360, engineConfiguration->globalTriggerAngleOffset));
TRIGGER_WAVEFORM(findTriggerPosition(&position, 360, engineConfiguration->globalTriggerAngleOffset));
assertTriggerPosition(&position, 6, 0);
eth.applyTriggerShape();
eth.applyTriggerWaveform();
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.fireTriggerEvents(48);
@ -203,7 +203,7 @@ TEST(misc, testFordAspire) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
ASSERT_EQ( 4, TRIGGER_SHAPE(getTriggerShapeSynchPointIndex())) << "getTriggerShapeSynchPointIndex";
ASSERT_EQ( 4, TRIGGER_WAVEFORM(getTriggerWaveformSynchPointIndex())) << "getTriggerWaveformSynchPointIndex";
ASSERT_EQ(800, config->fuelRpmBins[0]);
ASSERT_EQ(7000, config->fuelRpmBins[15]);
@ -228,11 +228,11 @@ static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPo
WITH_ENGINE_TEST_HELPER(type);
TriggerShape *t = &ENGINE(triggerCentral.triggerShape);
TriggerWaveform *t = &ENGINE(triggerCentral.triggerShape);
ASSERT_FALSE(t->shapeDefinitionError) << "isError";
assertEqualsM("synchPointIndex", synchPointIndex, t->getTriggerShapeSynchPointIndex());
assertEqualsM("synchPointIndex", synchPointIndex, t->getTriggerWaveformSynchPointIndex());
ASSERT_NEAR(channel1duty, t->expectedDutyCycle[0], 0.0001) << msg << " channel1duty";
ASSERT_NEAR(channel2duty, t->expectedDutyCycle[1], 0.0001) << msg << " channel2duty";
@ -307,7 +307,7 @@ TEST(misc, testRpmCalculator) {
engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->globalFuelCorrection = 3;
eth.applyTriggerShape();
eth.applyTriggerWaveform();
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
@ -318,8 +318,8 @@ TEST(misc, testRpmCalculator) {
ASSERT_EQ(0, GET_RPM());
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[241]));
ASSERT_EQ(5, TRIGGER_WAVEFORM(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_WAVEFORM(triggerIndexByAngle[241]));
eth.fireTriggerEvents(/* count */ 48);
@ -382,8 +382,8 @@ TEST(misc, testRpmCalculator) {
assertEqualsM("3/3", start + 14777, engine->executor.getForUnitTest(2)->momentX);
engine->executor.clear();
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[241]));
ASSERT_EQ(5, TRIGGER_WAVEFORM(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_WAVEFORM(triggerIndexByAngle[241]));
eth.fireFall(5);
@ -448,7 +448,7 @@ TEST(misc, testTriggerDecoder) {
persistent_config_s c;
Engine e(&c);
TriggerShape * s = &e.triggerCentral.triggerShape;
TriggerWaveform * s = &e.triggerCentral.triggerShape;
persistent_config_s *config = &c;
@ -457,7 +457,7 @@ TEST(misc, testTriggerDecoder) {
engine_configuration_s *engineConfiguration = &c.engineConfiguration;
board_configuration_s *boardConfiguration = &c.engineConfiguration.bc;
initializeSkippedToothTriggerShapeExt(s, 2, 0, FOUR_STROKE_CAM_SENSOR);
initializeSkippedToothTriggerWaveformExt(s, 2, 0, FOUR_STROKE_CAM_SENSOR);
assertEqualsM("shape size", s->getSize(), 4);
ASSERT_EQ(s->wave.switchTimes[0], 0.25);
ASSERT_EQ(s->wave.switchTimes[1], 0.5);
@ -507,7 +507,7 @@ TEST(misc, testTriggerDecoder) {
WITH_ENGINE_TEST_HELPER(MITSU_4G93);
// TriggerShape *t = &eth.engine.triggerShape;
// TriggerWaveform *t = &eth.engine.triggerShape;
// ASSERT_EQ(1, t->eventAngles[1]);
// ASSERT_EQ( 0, t->triggerIndexByAngle[56]) << "index at 0";
// ASSERT_EQ( 1, t->triggerIndexByAngle[57]) << "index at 1";

View File

@ -9,7 +9,7 @@
#include "trigger_mazda.h"
TEST(trigger, miataNA) {
TriggerShape naShape;
TriggerWaveform naShape;
initializeMazdaMiataNaShape(&naShape);

View File

@ -84,7 +84,7 @@ static void fireNoisyCycle60_2(EngineTestHelper *eth, int numCycles, int duratio
}
static void resetTrigger(EngineTestHelper &eth) {
eth.applyTriggerShape();
eth.applyTriggerWaveform();
eth.engine.triggerCentral.resetAccumSignalData();
// reset error counter
eth.engine.triggerCentral.triggerState.totalTriggerErrorCounter = 0;