auto-sync
This commit is contained in:
parent
a0900c6c73
commit
26dcdc0504
|
@ -36,7 +36,7 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->injectionMode = IM_BATCH;
|
||||
engineConfiguration->twoWireBatchInjection = true;
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
boardConfiguration->tachOutputPin = GPIOC_8;
|
||||
|
||||
|
|
|
@ -151,8 +151,7 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
// set_cranking_fuel 5
|
||||
engineConfiguration->cranking.baseFuel = 5;
|
||||
|
||||
// todo: finish implementation for 'useRiseEdge'
|
||||
// engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
// engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
/**
|
||||
* that's 1995 config
|
||||
|
|
|
@ -117,7 +117,7 @@ void setFordAspireEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
setSingleCoilDwell(engineConfiguration);
|
||||
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
|
||||
engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
engineConfiguration->trigger.type = TT_FORD_ASPIRE;
|
||||
|
||||
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
|
||||
|
|
|
@ -76,10 +76,27 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) {
|
|||
// engineConfiguration->algorithm = LM_PLAIN_MAF;
|
||||
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
|
||||
// engineConfiguration->algorithm = LM_REAL_MAF;
|
||||
boardConfiguration->tunerStudioSerialSpeed = 14400;
|
||||
|
||||
setFuelLoadBin(1.2, 4.4 PASS_ENGINE_PARAMETER);
|
||||
setFuelRpmBin(800, 7000 PASS_ENGINE_PARAMETER);
|
||||
|
||||
config->veRpmBins[0] = 800;
|
||||
config->veRpmBins[1] = 1200;
|
||||
config->veRpmBins[2] = 1600;
|
||||
config->veRpmBins[3] = 2000;
|
||||
config->veRpmBins[4] = 2400;
|
||||
config->veRpmBins[5] = 2800;
|
||||
config->veRpmBins[6] = 3200;
|
||||
config->veRpmBins[7] = 3600;
|
||||
config->veRpmBins[8] = 4100;
|
||||
config->veRpmBins[9] = 4500;
|
||||
config->veRpmBins[10] = 4900;
|
||||
config->veRpmBins[11] = 5300;
|
||||
config->veRpmBins[12] = 5700;
|
||||
config->veRpmBins[13] = 6100;
|
||||
config->veRpmBins[14] = 6500;
|
||||
config->veRpmBins[15] = 7000;
|
||||
|
||||
copyFuelTable(racingFestivaVeTable, config->veTable);
|
||||
|
||||
// boardConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU
|
||||
|
@ -173,7 +190,7 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) {
|
|||
boardConfiguration->malfunctionIndicatorPin = GPIOE_5;
|
||||
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
|
||||
|
||||
boardConfiguration->tunerStudioSerialSpeed = 9600;
|
||||
boardConfiguration->tunerStudioSerialSpeed = 19200;
|
||||
|
||||
commonFrankensoAnalogInputs(engineConfiguration);
|
||||
setCommonNTCSensor(&engineConfiguration->clt);
|
||||
|
@ -204,7 +221,23 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) {
|
|||
// set_fsio_expression 1 "rpm 0 fsio_setting >"
|
||||
setFsioExt(0, GPIOE_3, "rpm 0 fsio_setting >", 150 PASS_ENGINE_PARAMETER);
|
||||
|
||||
copyTimingTable(racingFestivaIgnitionTable, config->veTable);
|
||||
config->ignitionRpmBins[0] = 800;
|
||||
config->ignitionRpmBins[1] = 1200;
|
||||
config->ignitionRpmBins[2] = 1600;
|
||||
config->ignitionRpmBins[3] = 2000;
|
||||
config->ignitionRpmBins[4] = 2400;
|
||||
config->ignitionRpmBins[5] = 2800;
|
||||
config->ignitionRpmBins[6] = 3200;
|
||||
config->ignitionRpmBins[7] = 3600;
|
||||
config->ignitionRpmBins[8] = 4100;
|
||||
config->ignitionRpmBins[9] = 4500;
|
||||
config->ignitionRpmBins[10] = 4900;
|
||||
config->ignitionRpmBins[11] = 5300;
|
||||
config->ignitionRpmBins[12] = 5700;
|
||||
config->ignitionRpmBins[13] = 6100;
|
||||
config->ignitionRpmBins[14] = 6500;
|
||||
config->ignitionRpmBins[15] = 7000;
|
||||
copyTimingTable(racingFestivaIgnitionTable, config->ignitionTable);
|
||||
|
||||
// end of Ford Escort GT config
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
// with this complex trigger we do not need this by default
|
||||
boardConfiguration->sensorChartMode = SC_OFF;
|
||||
|
||||
engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
engineConfiguration->injectionMode = IM_BATCH;
|
||||
// enable two_wire_batch_injection
|
||||
|
|
|
@ -22,7 +22,7 @@ void setTestEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
||||
triggerConfig->customTotalToothCount = 60;
|
||||
triggerConfig->customSkippedToothCount = 0;
|
||||
engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_NONE;
|
||||
engineConfiguration->vbattAdcChannel = EFI_ADC_NONE;
|
||||
|
|
|
@ -207,18 +207,18 @@ case T_SECONDARY:
|
|||
}
|
||||
const char *getTrigger_event_e(trigger_event_e value){
|
||||
switch(value) {
|
||||
case SHAFT_3RD_DOWN:
|
||||
return "SHAFT_3RD_DOWN";
|
||||
case SHAFT_3RD_UP:
|
||||
return "SHAFT_3RD_UP";
|
||||
case SHAFT_PRIMARY_DOWN:
|
||||
return "SHAFT_PRIMARY_DOWN";
|
||||
case SHAFT_PRIMARY_UP:
|
||||
return "SHAFT_PRIMARY_UP";
|
||||
case SHAFT_SECONDARY_DOWN:
|
||||
return "SHAFT_SECONDARY_DOWN";
|
||||
case SHAFT_SECONDARY_UP:
|
||||
return "SHAFT_SECONDARY_UP";
|
||||
case SHAFT_3RD_FALLING:
|
||||
return "SHAFT_3RD_FALLING";
|
||||
case SHAFT_3RD_RISING:
|
||||
return "SHAFT_3RD_RISING";
|
||||
case SHAFT_PRIMARY_FALLING:
|
||||
return "SHAFT_PRIMARY_FALLING";
|
||||
case SHAFT_PRIMARY_RISING:
|
||||
return "SHAFT_PRIMARY_RISING";
|
||||
case SHAFT_SECONDARY_FALLING:
|
||||
return "SHAFT_SECONDARY_FALLING";
|
||||
case SHAFT_SECONDARY_RISING:
|
||||
return "SHAFT_SECONDARY_RISING";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->hasBaroSensor = false;
|
||||
engineConfiguration->isEngineChartEnabled = true;
|
||||
|
||||
engineConfiguration->useOnlyFrontForTrigger = false;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
||||
|
||||
boardConfiguration->idle.solenoidFrequency = 200;
|
||||
// set_idle_position 50
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Wed Feb 10 12:21:21 EST 2016
|
||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Feb 27 22:02:38 EST 2016
|
||||
// begin
|
||||
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
||||
#define ENGINE_CONFIGURATION_GENERATED_H_
|
||||
|
@ -1167,7 +1167,7 @@ typedef struct {
|
|||
/**
|
||||
* See #172
|
||||
offset 1500 bit 14 */
|
||||
bool useOnlyFrontForTrigger : 1;
|
||||
bool useOnlyRisingEdgeForTrigger : 1;
|
||||
/**
|
||||
* This is needed if batched igniton (waster spark) and individual coil wiring
|
||||
offset 1500 bit 15 */
|
||||
|
@ -1640,4 +1640,4 @@ typedef struct {
|
|||
|
||||
#endif
|
||||
// end
|
||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Wed Feb 10 12:21:21 EST 2016
|
||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Feb 27 22:02:38 EST 2016
|
||||
|
|
|
@ -191,14 +191,13 @@ typedef enum {
|
|||
T_CHANNEL_3 = 2
|
||||
} trigger_wheel_e;
|
||||
|
||||
// todo: better names?
|
||||
typedef enum {
|
||||
SHAFT_PRIMARY_DOWN = 0,
|
||||
SHAFT_PRIMARY_UP = 1,
|
||||
SHAFT_SECONDARY_DOWN = 2,
|
||||
SHAFT_SECONDARY_UP = 3,
|
||||
SHAFT_3RD_DOWN = 4,
|
||||
SHAFT_3RD_UP = 5,
|
||||
SHAFT_PRIMARY_FALLING = 0,
|
||||
SHAFT_PRIMARY_RISING = 1,
|
||||
SHAFT_SECONDARY_FALLING = 2,
|
||||
SHAFT_SECONDARY_RISING = 3,
|
||||
SHAFT_3RD_FALLING = 4,
|
||||
SHAFT_3RD_RISING = 5,
|
||||
} trigger_event_e;
|
||||
|
||||
/**
|
||||
|
|
|
@ -588,7 +588,7 @@
|
|||
#define isPrintTriggerSynchDetails_offset 1500
|
||||
#define isManualSpinningMode_offset 1500
|
||||
#define twoWireBatchInjection_offset 1500
|
||||
#define useOnlyFrontForTrigger_offset 1500
|
||||
#define useOnlyRisingEdgeForTrigger_offset 1500
|
||||
#define twoWireBatchIgnition_offset 1500
|
||||
#define engineChartSize_offset 1504
|
||||
#define targetIdleRpm_offset 1508
|
||||
|
|
|
@ -406,7 +406,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
|||
int engineCycleInt = (int) ENGINE(engineCycle);
|
||||
for (int angle = 0; angle < engineCycleInt; angle++) {
|
||||
int triggerShapeIndex = findAngleIndex(angle PASS_ENGINE_PARAMETER);
|
||||
if (engineConfiguration->useOnlyFrontForTrigger)
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger)
|
||||
triggerShapeIndex = triggerShapeIndex & 0xFFFFFFFE; // we need even index for front_only
|
||||
TRIGGER_SHAPE(triggerIndexByAngle[angle]) = triggerShapeIndex;
|
||||
}
|
||||
|
|
|
@ -839,7 +839,7 @@ static void enableOrDisable(const char *param, bool isEnabled) {
|
|||
} else if (strEqualCaseInsensitive(param, "stepperidle")) {
|
||||
boardConfiguration->useStepperIdle = isEnabled;
|
||||
} else if (strEqualCaseInsensitive(param, "trigger_only_front")) {
|
||||
engineConfiguration->useOnlyFrontForTrigger = isEnabled;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = isEnabled;
|
||||
incrementGlobalConfigurationVersion();
|
||||
} else if (strEqualCaseInsensitive(param, "use_only_first_channel")) {
|
||||
engineConfiguration->trigger.useOnlyFirstChannel = isEnabled;
|
||||
|
|
|
@ -411,7 +411,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
|||
prepareOutputSignals(PASS_ENGINE_PARAMETER_F);
|
||||
}
|
||||
|
||||
efiAssertVoid(!CONFIG(useOnlyFrontForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex");
|
||||
efiAssertVoid(!CONFIG(useOnlyRisingEdgeForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex");
|
||||
|
||||
if (eventIndex == CONFIG(ignMathCalculateAtIndex)) {
|
||||
if (CONFIG(externalKnockSenseAdc) != EFI_ADC_NONE) {
|
||||
|
|
|
@ -54,7 +54,7 @@ void TriggerCentral::addEventListener(ShaftPositionListener listener, const char
|
|||
* @brief Adds a trigger event listener
|
||||
*
|
||||
* Trigger event listener would be invoked on each trigger event. For example, for a 60/2 wheel
|
||||
* that would be 116 events: 58 SHAFT_PRIMARY_UP and 58 SHAFT_PRIMARY_DOWN events.
|
||||
* that would be 116 events: 58 SHAFT_PRIMARY_RISING and 58 SHAFT_PRIMARY_FALLING events.
|
||||
*/
|
||||
void addTriggerEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
|
||||
engine->triggerCentral.addEventListener(listener, name, engine);
|
||||
|
@ -119,7 +119,7 @@ static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType,
|
|||
shaft_signal_msg_index[0] = isUp ? 'u' : 'd';
|
||||
|
||||
addEngineSniffferEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||
if (engineConfiguration->useOnlyFrontForTrigger) {
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
// let's add the opposite event right away
|
||||
shaft_signal_msg_index[0] = isUp ? 'd' : 'u';
|
||||
addEngineSniffferEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||
|
@ -293,7 +293,7 @@ void triggerInfo(void) {
|
|||
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s gapBothDirections=%s useOnlyFirstChannel=%s",
|
||||
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
|
||||
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
|
||||
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyFrontForTrigger),
|
||||
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger),
|
||||
boolToString(TRIGGER_SHAPE(gapBothDirections)),
|
||||
boolToString(engineConfiguration->trigger.useOnlyFirstChannel));
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static trigger_wheel_e eventIndex[6] = { T_PRIMARY, T_PRIMARY, T_SECONDARY, T_SE
|
|||
/* odd event - start accumulation */ \
|
||||
currentCycle.timeOfPreviousEventNt[triggerWheel] = nowNt; \
|
||||
} \
|
||||
if (engineConfiguration->useOnlyFrontForTrigger) {currentCycle.current_index++;} \
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {currentCycle.current_index++;} \
|
||||
currentCycle.current_index++; \
|
||||
}
|
||||
|
||||
|
@ -122,11 +122,11 @@ static trigger_wheel_e eventIndex[6] = { T_PRIMARY, T_PRIMARY, T_SECONDARY, T_SE
|
|||
* @param nowNt current time
|
||||
*/
|
||||
void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t nowNt DECLARE_ENGINE_PARAMETER_S) {
|
||||
efiAssertVoid(signal <= SHAFT_3RD_UP, "unexpected signal");
|
||||
efiAssertVoid(signal <= SHAFT_3RD_RISING, "unexpected signal");
|
||||
|
||||
trigger_wheel_e triggerWheel = eventIndex[signal];
|
||||
|
||||
if (!engineConfiguration->useOnlyFrontForTrigger && curSignal == prevSignal) {
|
||||
if (!engineConfiguration->useOnlyRisingEdgeForTrigger && curSignal == prevSignal) {
|
||||
orderingErrorCounter++;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
/**
|
||||
* in case of noise the counter could be above the expected number of events
|
||||
*/
|
||||
int d = engineConfiguration->useOnlyFrontForTrigger ? 2 : 1;
|
||||
int d = engineConfiguration->useOnlyRisingEdgeForTrigger ? 2 : 1;
|
||||
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= TRIGGER_SHAPE(size) - d);
|
||||
|
||||
}
|
||||
|
|
|
@ -126,8 +126,8 @@ bool isTriggerDecoderError(void);
|
|||
|
||||
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
|
||||
|
||||
#define isLessImportant(signal) ((TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_UP) \
|
||||
|| (!TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_DOWN) \
|
||||
#define isLessImportant(signal) ((TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_RISING) \
|
||||
|| (!TRIGGER_SHAPE(useRiseEdge) && signal != SHAFT_PRIMARY_FALLING) \
|
||||
|| (!considerEventForGap()) \
|
||||
)
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ EXTERN_ENGINE
|
|||
;
|
||||
|
||||
static void fireShaftSignal(trigger_event_e signal) {
|
||||
if (!engineConfiguration->useOnlyFrontForTrigger || isRisingEdge[(int) signal])
|
||||
if (!engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal])
|
||||
hwHandleShaftSignal(signal);
|
||||
}
|
||||
|
||||
|
@ -57,17 +57,17 @@ void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIn
|
|||
|
||||
if (primaryWheelState != newPrimaryWheelState) {
|
||||
primaryWheelState = newPrimaryWheelState;
|
||||
fireShaftSignal(primaryWheelState ? SHAFT_PRIMARY_UP : SHAFT_PRIMARY_DOWN);
|
||||
fireShaftSignal(primaryWheelState ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING);
|
||||
}
|
||||
|
||||
if (secondaryWheelState != newSecondaryWheelState) {
|
||||
secondaryWheelState = newSecondaryWheelState;
|
||||
fireShaftSignal(secondaryWheelState ? SHAFT_SECONDARY_UP : SHAFT_SECONDARY_DOWN);
|
||||
fireShaftSignal(secondaryWheelState ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING);
|
||||
}
|
||||
|
||||
if (thirdWheelState != new3rdWheelState) {
|
||||
thirdWheelState = new3rdWheelState;
|
||||
fireShaftSignal(thirdWheelState ? SHAFT_3RD_UP : SHAFT_3RD_DOWN);
|
||||
fireShaftSignal(thirdWheelState ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING);
|
||||
}
|
||||
|
||||
// print("hello %d\r\n", chTimeNow());
|
||||
|
|
|
@ -37,26 +37,26 @@ void TriggerStimulatorHelper::nextStep(TriggerState *state, TriggerShape * shape
|
|||
|
||||
if (primaryWheelState != newPrimaryWheelState) {
|
||||
primaryWheelState = newPrimaryWheelState;
|
||||
trigger_event_e s = primaryWheelState ? SHAFT_PRIMARY_UP : SHAFT_PRIMARY_DOWN;
|
||||
trigger_event_e s = primaryWheelState ? SHAFT_PRIMARY_RISING : SHAFT_PRIMARY_FALLING;
|
||||
state->decodeTriggerEvent(s, time PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
if (secondaryWheelState != newSecondaryWheelState) {
|
||||
secondaryWheelState = newSecondaryWheelState;
|
||||
trigger_event_e s = secondaryWheelState ? SHAFT_SECONDARY_UP : SHAFT_SECONDARY_DOWN;
|
||||
trigger_event_e s = secondaryWheelState ? SHAFT_SECONDARY_RISING : SHAFT_SECONDARY_FALLING;
|
||||
state->decodeTriggerEvent(s, time PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
if (thirdWheelState != new3rdWheelState) {
|
||||
thirdWheelState = new3rdWheelState;
|
||||
trigger_event_e s = thirdWheelState ? SHAFT_3RD_UP : SHAFT_3RD_DOWN;
|
||||
trigger_event_e s = thirdWheelState ? SHAFT_3RD_RISING : SHAFT_3RD_FALLING;
|
||||
state->decodeTriggerEvent(s, time PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(uint32_t index, TriggerState *state, TriggerShape * shape,
|
||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S) {
|
||||
int startIndex = engineConfiguration->useOnlyFrontForTrigger ? index + 2 : index + 1;
|
||||
int startIndex = engineConfiguration->useOnlyRisingEdgeForTrigger ? index + 2 : index + 1;
|
||||
|
||||
for (uint32_t i = startIndex; i <= index + 2 * shape->getSize(); i++) {
|
||||
nextStep(state, shape, i, triggerConfig PASS_ENGINE_PARAMETER);
|
||||
|
|
|
@ -94,7 +94,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
|
|||
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;
|
||||
float angle = getAngle(triggerDefinitionCoordinate) - firstAngle;
|
||||
fixAngle(angle);
|
||||
if (engineConfiguration->useOnlyFrontForTrigger) {
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
if (isFrontEvent[triggerDefinitionIndex]) {
|
||||
frontOnlyIndex += 2;
|
||||
eventAngles[frontOnlyIndex] = angle;
|
||||
|
@ -169,8 +169,8 @@ void TriggerState::reset() {
|
|||
totalTriggerErrorCounter = 0;
|
||||
orderingErrorCounter = 0;
|
||||
currentDuration = 0;
|
||||
curSignal = SHAFT_PRIMARY_DOWN;
|
||||
prevSignal = SHAFT_PRIMARY_DOWN;
|
||||
curSignal = SHAFT_PRIMARY_FALLING;
|
||||
prevSignal = SHAFT_PRIMARY_FALLING;
|
||||
prevCycleDuration = 0;
|
||||
startOfCycleNt = 0;
|
||||
|
||||
|
@ -289,7 +289,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const waveIndex, trig
|
|||
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
// todo: PASS_ENGINE?
|
||||
if (!engineConfiguration->useOnlyFrontForTrigger || stateParam == TV_RISE) {
|
||||
if (!engineConfiguration->useOnlyRisingEdgeForTrigger || stateParam == TV_RISE) {
|
||||
expectedEventCount[waveIndex]++;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ static void shaft_icu_width_callback(ICUDriver *icup) {
|
|||
}
|
||||
// icucnt_t last_width = icuGetWidth(icup); so far we are fine with system time
|
||||
// todo: add support for 3rd channel
|
||||
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_UP : SHAFT_SECONDARY_UP;
|
||||
trigger_event_e signal = isPrimary ? SHAFT_PRIMARY_RISING : SHAFT_SECONDARY_RISING;
|
||||
|
||||
hwHandleShaftSignal(signal);
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ static void shaft_icu_period_callback(ICUDriver *icup) {
|
|||
// todo: add support for 3rd channel
|
||||
// icucnt_t last_period = icuGetPeriod(icup); so far we are fine with system time
|
||||
trigger_event_e signal =
|
||||
isPrimary ? SHAFT_PRIMARY_DOWN : SHAFT_SECONDARY_DOWN;
|
||||
if (CONFIG(useOnlyFrontForTrigger))
|
||||
isPrimary ? SHAFT_PRIMARY_FALLING : SHAFT_SECONDARY_FALLING;
|
||||
if (CONFIG(useOnlyRisingEdgeForTrigger))
|
||||
return;
|
||||
hwHandleShaftSignal(signal);
|
||||
}
|
||||
|
@ -80,10 +80,10 @@ static ICUDriver *turnOnTriggerInputPin(brain_pin_e hwPin) {
|
|||
// todo: reuse 'setWaveReaderMode' method here?
|
||||
if (driver != NULL) {
|
||||
// todo: once http://forum.chibios.org/phpbb/viewtopic.php?f=16&t=1757 is fixed
|
||||
// bool needWidthCallback = !CONFIG(useOnlyFrontForTrigger) || TRIGGER_SHAPE(useRiseEdge);
|
||||
// bool needWidthCallback = !CONFIG(useOnlyRisingEdgeForTrigger) || TRIGGER_SHAPE(useRiseEdge);
|
||||
// shaft_icucfg.width_cb = needWidthCallback ? shaft_icu_width_callback : NULL;
|
||||
|
||||
// bool needPeriodCallback = !CONFIG(useOnlyFrontForTrigger) || !TRIGGER_SHAPE(useRiseEdge);
|
||||
// bool needPeriodCallback = !CONFIG(useOnlyRisingEdgeForTrigger) || !TRIGGER_SHAPE(useRiseEdge);
|
||||
// shaft_icucfg.period_cb = needPeriodCallback ? shaft_icu_period_callback : NULL;
|
||||
|
||||
efiIcuStart(driver, &shaft_icucfg);
|
||||
|
|
|
@ -533,7 +533,7 @@ custom idle_mode_e 4 bits, U32, @OFFSET@, [0:0], "false", "true"
|
|||
bit isPrintTriggerSynchDetails
|
||||
bit isManualSpinningMode;Usually if we have no trigger events that means engine is stopped\nUnless we are troubleshooting and spinning the engine by hand - this case a longer\ndelay is needed
|
||||
bit twoWireBatchInjection;This is needed if batched injection and individual injector wiring
|
||||
bit useOnlyFrontForTrigger;See #172
|
||||
bit useOnlyRisingEdgeForTrigger;See #172
|
||||
bit twoWireBatchIgnition;This is needed if batched igniton (waster spark) and individual coil wiring
|
||||
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ void EngineTestHelper::fireTriggerEvents(int count) {
|
|||
for (int i = 0; i < count; i++) {
|
||||
timeNow += 5000; // 5ms
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfiguration->bc;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
timeNow += 5000;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,38 +69,38 @@ static void testDodgeNeonDecoder(void) {
|
|||
assertFalseM("1 shaft_is_synchronized", state.shaft_is_synchronized);
|
||||
|
||||
// int r = 0;
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 60);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
|
||||
// assertFalseM("2 shaft_is_synchronized", state.shaft_is_synchronized); // still no synchronization
|
||||
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 210);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
|
||||
// assertFalseM("3 shaft_is_synchronized", state.shaft_is_synchronized); // still no synchronization
|
||||
//
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 420);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
|
||||
// assertFalseM("4 shaft_is_synchronized", state.shaft_is_synchronized); // still no synchronization
|
||||
//
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 630);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
|
||||
// assertFalse(state.shaft_is_synchronized); // still no synchronization
|
||||
//
|
||||
// printf("2nd camshaft revolution\r\n");
|
||||
// r = 720;
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 60);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 210);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
|
||||
// assertTrue(state.shaft_is_synchronized);
|
||||
// assertEquals(0, state.current_index);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 420);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
|
||||
// assertEquals(1, state.current_index);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 630);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
|
||||
// assertEquals(2, state.current_index);
|
||||
//
|
||||
// printf("3rd camshaft revolution\r\n");
|
||||
// r = 2 * 720;
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 60);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
|
||||
// assertEqualsM("current index", 3, state.current_index);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 210);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
|
||||
// assertTrue(state.shaft_is_synchronized);
|
||||
// assertEqualsM("current index", 0, state.current_index);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_UP, r + 420);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_DOWN, r + 630);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
|
||||
}
|
||||
|
||||
static void assertTriggerPosition(event_trigger_position_s *position, int eventIndex, float angleOffset) {
|
||||
|
@ -158,28 +158,28 @@ void test1995FordInline6TriggerDecoder(void) {
|
|||
|
||||
assertFalseM("shaft_is_synchronized", state.shaft_is_synchronized);
|
||||
int r = 10;
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_DOWN, r PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r PASS_ENGINE_PARAMETER);
|
||||
assertFalseM("shaft_is_synchronized", state.shaft_is_synchronized); // still no synchronization
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_UP, ++r PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_RISING, ++r PASS_ENGINE_PARAMETER);
|
||||
assertTrue(state.shaft_is_synchronized); // first signal rise synchronize
|
||||
assertEquals(0, state.getCurrentIndex());
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_DOWN, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEquals(1, state.getCurrentIndex());
|
||||
|
||||
for (int i = 2; i < 10;) {
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_UP, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("even", i++, state.getCurrentIndex());
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_DOWN, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("odd", i++, state.getCurrentIndex());
|
||||
}
|
||||
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_UP, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEquals(10, state.getCurrentIndex());
|
||||
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_DOWN, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEquals(11, state.getCurrentIndex());
|
||||
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_UP, r++ PASS_ENGINE_PARAMETER);
|
||||
state.decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER);
|
||||
assertEquals(0, state.getCurrentIndex()); // new revolution
|
||||
|
||||
assertEqualsM("running dwell", 0.5, getSparkDwell(2000 PASS_ENGINE_PARAMETER));
|
||||
|
@ -354,7 +354,7 @@ void testRpmCalculator(void) {
|
|||
InjectionEvent *ie0 = ð.engine.engineConfiguration2->injectionEvents->injectionEvents.elements[0];
|
||||
assertEqualsM("injection angle", 0, ie0->injectionStart.angleOffset);
|
||||
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEquals(1500, eth.engine.rpmCalculator.rpmValue);
|
||||
|
||||
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
|
||||
|
@ -393,11 +393,11 @@ void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000;
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("index #3", 3, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||
assertEqualsM("ev 3", st + 13333, schedulingQueue.getForUnitText(0)->momentX);
|
||||
|
@ -412,15 +412,15 @@ void testRpmCalculator(void) {
|
|||
timeNow += 5000;
|
||||
assertEqualsM("Size 4.1", 6, engine->engineConfiguration2->injectionEvents->eventsCount);
|
||||
assertFalseM("No squirts expected 4.1", engine->engineConfiguration2->injectionEvents->hasEvents[4]);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 4.1", 0, schedulingQueue.size());
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 4.2", 6, schedulingQueue.size());
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 4.3", 6, schedulingQueue.size());
|
||||
|
||||
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
|
||||
|
@ -443,12 +443,12 @@ void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 5", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 6", 6, schedulingQueue.size());
|
||||
assertEqualsM("6/0", st + 40000, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("6/1", st + 40000, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -456,12 +456,12 @@ void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 7", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 8", 6, schedulingQueue.size());
|
||||
assertEqualsM("8/0", st + 53333, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("8/1", st + 53333, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -470,12 +470,12 @@ void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 9", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 10", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ void testTriggerDecoder(void) {
|
|||
assertEqualsM("index for 668", 11, t->triggerIndexByAngle[668]);
|
||||
|
||||
|
||||
eth.persistentConfig.engineConfiguration.useOnlyFrontForTrigger = false;
|
||||
eth.persistentConfig.engineConfiguration.useOnlyRisingEdgeForTrigger = false;
|
||||
eth.persistentConfig.engineConfiguration.bc.sensorChartMode = SC_DETAILED_RPM;
|
||||
applyNonPersistentConfiguration(NULL PASS_ENGINE_PARAMETER);
|
||||
|
||||
|
@ -574,8 +574,8 @@ void testTriggerDecoder(void) {
|
|||
EngineTestHelper eth(DODGE_NEON_2003);
|
||||
EXPAND_EngineTestHelper;
|
||||
|
||||
printf("!!!!!!!!!!!!!!!!!! Now trying with only front events !!!!!!!!!!!!!!!!!\r\n");
|
||||
engineConfiguration->useOnlyFrontForTrigger = true;
|
||||
printf("!!!!!!!!!!!!!!!!!! Now trying with only rising edges !!!!!!!!!!!!!!!!!\r\n");
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
||||
applyNonPersistentConfiguration(NULL PASS_ENGINE_PARAMETER);
|
||||
prepareShapes(PASS_ENGINE_PARAMETER_F);
|
||||
|
|
Loading…
Reference in New Issue