WFT is wrong with MRE_miata_na6 config? operationMode complexity #898

more refactoring
This commit is contained in:
rusefi 2019-08-08 00:32:31 -04:00
parent f25b1e5f2f
commit 643cc24931
9 changed files with 21 additions and 30 deletions

View File

@ -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;
}

View File

@ -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) {

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Aug 02 01:26:57 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Aug 08 00:19:31 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -1338,12 +1338,12 @@ struct engine_configuration_s {
*/
int canSleepPeriodMs;
/**
* '4 stroke with symmetrical crank' is a pretty special case for example on Miata NB2
* '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
* See engineCycle
* set operation_mode X
* offset 488
*/
operation_mode_e operationMode;
operation_mode_e ambiguousOperationMode;
/**
* offset 492
*/
@ -2814,4 +2814,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Aug 02 01:26:57 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Aug 08 00:19:31 EDT 2019

View File

@ -79,6 +79,8 @@
#define alternatorOffAboveTps_offset_hex 7ec
#define alternatorPwmFrequency_offset 2256
#define alternatorPwmFrequency_offset_hex 8d0
#define ambiguousOperationMode_offset 488
#define ambiguousOperationMode_offset_hex 1e8
#define analogInputDividerCoefficient_offset 460
#define analogInputDividerCoefficient_offset_hex 1cc
#define autoTuneCltThreshold_offset 2420
@ -1489,8 +1491,6 @@
#define oilPressure_value2_offset_hex a94
#define onOffAlternatorLogic_offset 744
#define onOffAlternatorLogic_offset_hex 2e8
#define operationMode_offset 488
#define operationMode_offset_hex 1e8
#define output_pin_e_enum "NONE", "INVALID", "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15", "PF0","PF1","PF2","PF3","PF4","PF5","PF6","PF7","PF8","PF9","PF10","PF11","PF12","PF13","PF14","PF15", "PG0","PG1","PG2","PG3","PG4","PG5","PG6","PG7","PG8","PG9","PG10","PG11","PG12","PG13","PG14","PG15", "PH0","PH1","PH2","PH3","PH4","PH5","PH6","PH7","PH8","PH9","PH10","PH11","PH12","PH13","PH14","PH15","TLE6240_1", "TLE6240_2", "TLE6240_3", "TLE6240_4", "TLE6240_5", "TLE6240_6", "TLE6240_7", "TLE6240_8", "TLE6240_9", "TLE6240_10", "TLE6240_11", "TLE6240_12", "TLE6240_13", "TLE6240_14", "TLE6240_15", "TLE6240_16", "MC33972_1", "MC33972_2", "MC33972_3", "MC33972_4", "MC33972_5", "MC33972_6", "MC33972_7", "MC33972_8", "MC33972_9", "MC33972_10", "MC33972_11", "MC33972_12", "MC33972_13", "MC33972_14", "MC33972_15", "MC33972_16", "MC33972_17", "MC33972_18", "MC33972_19", "MC33972_20", "MC33972_21", "MC33972_22", "TLE8888_1", "TLE8888_2", "TLE8888_3", "TLE8888_4", "TLE8888_5", "TLE8888_6", "TLE8888_7", "TLE8888_8", "TLE8888_9", "TLE8888_10", "TLE8888_11", "TLE8888_12", "TLE8888_13", "TLE8888_14", "TLE8888_15", "TLE8888_16", "TLE8888_17", "TLE8888_18", "TLE8888_19", "TLE8888_20", "TLE8888_21", "TLE8888_22", "TLE8888_23", "TLE8888_24", "TLE8888_25", "TLE8888_26", "TLE8888_27", "TLE8888_28", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
#define overrideCrankingIacSetting_offset 1476
#define overrideCrankingIacSetting_offset_hex 5c4

View File

@ -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) ||

View File

@ -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);
}

View File

@ -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;

View File

@ -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

View File

@ -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";