refactoring: let's use different names for different things

This commit is contained in:
Andrey 2022-09-05 01:16:24 -04:00
parent feb386a54b
commit c1b218b772
7 changed files with 13 additions and 9 deletions

View File

@ -595,7 +595,7 @@ operation_mode_e Engine::getOperationMode() {
// Ignore user-provided setting for well known triggers.
if (doesTriggerImplyOperationMode(engineConfiguration->trigger.type)) {
// For example for Miata NA, there is no reason to allow user to set FOUR_STROKE_CRANK_SENSOR
return triggerCentral.triggerShape.getOperationMode();
return triggerCentral.triggerShape.getWheelOperationMode();
} else {
// For example 36-1, could be on either cam or crank, so we have to ask the user
return lookupOperationMode();

View File

@ -82,7 +82,7 @@ expected<float> InjectionEvent::computeInjectionAngle(int cylinderIndex) const {
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(openingAngle), "findAngle#3", false);
assertAngleRange(openingAngle, "findAngle#a33", CUSTOM_ERR_6544);
wrapAngle2(openingAngle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(engine->triggerCentral.triggerShape.getOperationMode()));
wrapAngle2(openingAngle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(engine->triggerCentral.triggerShape.getWheelOperationMode()));
#if EFI_UNIT_TEST
printf("registerInjectionEvent openingAngle=%.2f inj %d\r\n", openingAngle, cylinderNumber);

View File

@ -190,7 +190,7 @@ void InjectionEvent::onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase
#if EFI_PRINTF_FUEL_DETAILS
if (printFuelDebug) {
printf("fuel injectionDuration=%.2fms adjusted=%.2fms\n",
engine->injectionDuration,
engine->engineState.injectionDuration,
injectionDuration);
}
#endif /*EFI_PRINTF_FUEL_DETAILS */

View File

@ -118,7 +118,7 @@ angle_t TriggerWaveform::getCycleDuration() const {
}
bool TriggerWaveform::needsDisambiguation() const {
switch (getOperationMode()) {
switch (getWheelOperationMode()) {
case FOUR_STROKE_CRANK_SENSOR:
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
case FOUR_STROKE_THREE_TIMES_CRANK_SENSOR:
@ -177,7 +177,11 @@ void TriggerWaveform::addEventClamped(angle_t angle, trigger_wheel_e const chann
}
}
operation_mode_e TriggerWaveform::getOperationMode() const {
/**
* See also Engine#getOperationMode which accounts for additional settings which are
* needed to resolve precise mode for vague wheels
*/
operation_mode_e TriggerWaveform::getWheelOperationMode() const {
return operationMode;
}
@ -410,7 +414,7 @@ void findTriggerPosition(TriggerWaveform *triggerShape,
// convert engine cycle angle into trigger cycle angle
angle += triggerShape->tdcPosition + engineConfiguration->globalTriggerAngleOffset;
efiAssertVoid(CUSTOM_ERR_6577, !cisnan(angle), "findAngle#2");
wrapAngle2(angle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(triggerShape->getOperationMode()));
wrapAngle2(angle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(triggerShape->getWheelOperationMode()));
int triggerEventIndex = triggerShape->findAngleIndex(details, angle);
angle_t triggerEventAngle = details->eventAngles[triggerEventIndex];

View File

@ -223,7 +223,7 @@ public:
* Deprecated?
*/
void addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, trigger_value_e const stateParam, float filterLeft, float filterRight);
operation_mode_e getOperationMode() const;
operation_mode_e getWheelOperationMode() const;
void initialize(operation_mode_e operationMode);
void setTriggerSynchronizationGap(float syncRatio);

View File

@ -694,7 +694,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
* If we only have a crank position sensor with four stroke, here we are extending crank revolutions with a 360 degree
* cycle into a four stroke, 720 degrees cycle.
*/
int crankDivider = getCrankDivider(triggerShape.getOperationMode());
int crankDivider = getCrankDivider(triggerShape.getWheelOperationMode());
int crankInternalIndex = triggerState.getTotalRevolutionCounter() % crankDivider;
int triggerIndexForListeners = decodeResult.Value.CurrentIndex + (crankInternalIndex * triggerShape.getSize());

View File

@ -69,7 +69,7 @@ TEST_P(AllTriggersFixture, TestTrigger) {
fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\n", tt, shape->getLength(), getTrigger_type_e(tt), shape->tdcPosition);
fprintf(fp, "%s=%s\n", TRIGGER_HARDCODED_OPERATION_MODE, shape->knownOperationMode ? "true" : "false");
fprintf(fp, "%s=%s\n", TRIGGER_IS_CRANK_KEY, shape->knownOperationMode && (shape->getOperationMode() == FOUR_STROKE_CRANK_SENSOR) ? "true" : "false");
fprintf(fp, "%s=%s\n", TRIGGER_IS_CRANK_KEY, shape->knownOperationMode && (shape->getWheelOperationMode() == FOUR_STROKE_CRANK_SENSOR) ? "true" : "false");
fprintf(fp, "%s=%s\n", TRIGGER_HAS_SECOND_CHANNEL, shape->needSecondTriggerInput ? "true" : "false");
fprintf(fp, "%s=%s\n", TRIGGER_IS_SECOND_WHEEL_CAM, shape->isSecondWheelCam ? "true" : "false");