WFT is wrong with MRE_miata_na6 config? operationMode complexity #898
more refactoring
This commit is contained in:
parent
43962ccff0
commit
334f021137
|
@ -59,7 +59,7 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF
|
|||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
TRIGGER_SHAPE(initializeTriggerShape(logger,
|
||||
engineConfiguration->operationMode,
|
||||
engineConfiguration->ambiguousOperationMode,
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger, &engineConfiguration->trigger));
|
||||
|
||||
if (!TRIGGER_SHAPE(shapeDefinitionError)) {
|
||||
|
@ -315,7 +315,7 @@ static bool doesTriggerImplyOperationMode(trigger_type_e type) {
|
|||
|
||||
operation_mode_e Engine::getOperationMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
//return doesTriggerImplyOperationMode(engineConfiguration->trigger.type) ? triggerCentral.triggerShape.getOperationMode() : engineConfiguration->ambiguousOperationMode;
|
||||
return engineConfiguration->operationMode;
|
||||
return engineConfiguration->ambiguousOperationMode;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1283,12 +1283,6 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
|||
warning(CUSTOM_UNEXPECTED_ENGINE_TYPE, "Unexpected engine type: %d", engineType);
|
||||
}
|
||||
applyNonPersistentConfiguration(logger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
// todo: eliminate triggerShape.operationMode?
|
||||
if (engineConfiguration->operationMode != TRIGGER_SHAPE(getOperationMode())) {
|
||||
warning(CUSTOM_ERR_OP_MODE, "operationMode %d/trigger mismatch %d",
|
||||
engineConfiguration->operationMode,
|
||||
TRIGGER_SHAPE(getOperationMode()));
|
||||
}
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
syncTunerStudioCopy();
|
||||
|
@ -1339,11 +1333,7 @@ float getRpmMultiplier(operation_mode_e mode) {
|
|||
}
|
||||
|
||||
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode) {
|
||||
engineConfiguration->operationMode = mode;
|
||||
}
|
||||
|
||||
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration) {
|
||||
return engineConfiguration->operationMode;
|
||||
engineConfiguration->ambiguousOperationMode = mode;
|
||||
}
|
||||
|
||||
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) {
|
||||
|
|
|
@ -361,12 +361,13 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
* cycle into a four stroke, 720 degrees cycle.
|
||||
*/
|
||||
int triggerIndexForListeners;
|
||||
if (engineConfiguration->operationMode == FOUR_STROKE_CAM_SENSOR ||
|
||||
engineConfiguration->operationMode == TWO_STROKE) {
|
||||
operation_mode_e operationMode = engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
if (operationMode == FOUR_STROKE_CAM_SENSOR ||
|
||||
operationMode == TWO_STROKE) {
|
||||
// That's easy - trigger cycle matches engine cycle
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex();
|
||||
} else {
|
||||
int crankDivider = engineConfiguration->operationMode == FOUR_STROKE_CRANK_SENSOR ? 2 : 4;
|
||||
int crankDivider = operationMode == FOUR_STROKE_CRANK_SENSOR ? 2 : 4;
|
||||
|
||||
int crankInternalIndex = triggerState.getTotalRevolutionCounter() % crankDivider;
|
||||
|
||||
|
@ -459,7 +460,7 @@ void printAllTriggers() {
|
|||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
engineConfiguration->trigger.type = tt;
|
||||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
|
||||
TriggerShape *s = &engine->triggerCentral.triggerShape;
|
||||
engine->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
@ -673,7 +674,7 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig
|
|||
|
||||
changed |=
|
||||
COMPARE_CONFIG_PARAMS(trigger.type) ||
|
||||
COMPARE_CONFIG_PARAMS(operationMode) ||
|
||||
COMPARE_CONFIG_PARAMS(ambiguousOperationMode) ||
|
||||
COMPARE_CONFIG_PARAMS(useOnlyRisingEdgeForTrigger) ||
|
||||
COMPARE_CONFIG_PARAMS(globalTriggerAngleOffset) ||
|
||||
COMPARE_CONFIG_PARAMS(trigger.customTotalToothCount) ||
|
||||
|
|
|
@ -102,7 +102,7 @@ void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
if (rpm == 0) {
|
||||
triggerSignal.setFrequency(NAN);
|
||||
} else {
|
||||
float rpmM = getRpmMultiplier(engineConfiguration->operationMode);
|
||||
float rpmM = getRpmMultiplier(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
float rPerSecond = rpm * rpmM / 60.0; // per minute converted to per second
|
||||
triggerSignal.setFrequency(rPerSecond);
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ int canSleepPeriodMs;CANbus thread period, ms;"ms", 1, 0, 0, 1000
|
|||
|
||||
|
||||
custom operation_mode_e 4 bits, U32, @OFFSET@, [0:2], "INVALID", "4 stroke without cam sensor", "4 stroke with cam sensor", "2 stroke", "4 stroke with symmetrical crank (requires VVT input)", "INVALID", "INVALID", "INVALID"
|
||||
operation_mode_e operationMode;+'4 stroke with symmetrical crank' is a pretty special case for example on Miata NB2\nSee engineCycle\nset operation_mode X
|
||||
operation_mode_e ambiguousOperationMode;+'Some triggers could be mounted differently. Most well-known triggers imply specific sensor setup. 4 stroke with symmetrical crank' is a pretty special case for example on Miata NB2\nSee engineCycle\nset operation_mode X
|
||||
|
||||
custom display_mode_e 4 bits, U32, @OFFSET@, [0:1], "none", "hd44780", "hd44780 over pcf8574", "INVALID"
|
||||
display_mode_e displayMode;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// This file was generated by Version2Header
|
||||
// Wed Aug 07 22:44:31 EDT 2019
|
||||
// Thu Aug 08 00:19:27 EDT 2019
|
||||
|
||||
|
||||
#ifndef GIT_HASH
|
||||
#define GIT_HASH "1f8bfa4ee0f861b8087f350381e2c462be2b9bd8"
|
||||
#define GIT_HASH "51110b33ad6a0867421728746311e7a5019b5f11"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "19676"
|
||||
#define VCS_VERSION "19679"
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ TEST(misc, testEngineMath) {
|
|||
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
||||
|
||||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
|
||||
ASSERT_NEAR( 50, getOneDegreeTimeMs(600) * 180, EPS4D) << "600 RPM";
|
||||
ASSERT_EQ( 5, getOneDegreeTimeMs(6000) * 180) << "6000 RPM";
|
||||
|
|
Loading…
Reference in New Issue