refactoring: extracting method to facilitate debugging
This commit is contained in:
parent
7a00ccd2ce
commit
676035f950
|
@ -215,7 +215,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
|||
if (privateTriggerDefinitionSize > 0) {
|
||||
if (angle <= previousAngle) {
|
||||
warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: new=%.2f and prev=%.2f, size=%d", angle, previousAngle, privateTriggerDefinitionSize);
|
||||
shapeDefinitionError = true;
|
||||
setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
|||
|
||||
if (wave->pinStates == NULL) {
|
||||
warning(CUSTOM_ERR_STATE_NULL, "wave pinStates is NULL");
|
||||
shapeDefinitionError = true;
|
||||
setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
wave->setState(/* switchIndex */ 0, /* value */ initialState[i]);
|
||||
|
@ -242,7 +242,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
|||
int exactMatch = wave.findAngleMatch(angle, privateTriggerDefinitionSize);
|
||||
if (exactMatch != EFI_ERROR_CODE) {
|
||||
warning(CUSTOM_ERR_SAME_ANGLE, "same angle: not supported");
|
||||
shapeDefinitionError = true;
|
||||
setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -344,6 +344,10 @@ int TriggerShape::findAngleIndex(float target) const {
|
|||
return left - 1;
|
||||
}
|
||||
|
||||
void TriggerShape::setShapeDefinitionError(bool value) {
|
||||
shapeDefinitionError = value;
|
||||
}
|
||||
|
||||
void TriggerShape::findTriggerPosition(event_trigger_position_s *position,
|
||||
angle_t angleOffset DEFINE_CONFIG_PARAM(angle_t, globalTriggerAngleOffset)) {
|
||||
efiAssertVoid(CUSTOM_ERR_6574, !cisnan(angleOffset), "findAngle#1");
|
||||
|
@ -594,7 +598,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e oper
|
|||
break;
|
||||
|
||||
default:
|
||||
shapeDefinitionError = true;
|
||||
setShapeDefinitionError(true);
|
||||
warning(CUSTOM_ERR_NO_SHAPE, "initializeTriggerShape() not implemented: %d", triggerConfig->type);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig);
|
||||
void findTriggerPosition(event_trigger_position_s *position,
|
||||
angle_t angleOffset DEFINE_CONFIG_PARAM(angle_t, globalTriggerAngleOffset));
|
||||
void setShapeDefinitionError(bool value);
|
||||
|
||||
/**
|
||||
* Simplest trigger shape does not require any synchronization - for example if there is only
|
||||
|
|
|
@ -32,7 +32,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
|
|||
operation_mode_e operationMode) {
|
||||
if (totalTeethCount <= 0) {
|
||||
warning(CUSTOM_OBD_TRIGGER_SHAPE, "totalTeethCount is zero or less: %d", totalTeethCount);
|
||||
s->shapeDefinitionError = true;
|
||||
s->setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
efiAssertVoid(CUSTOM_ERR_6588, s != NULL, "TriggerShape is NULL");
|
||||
|
|
|
@ -118,7 +118,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE
|
|||
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);
|
||||
shape->shapeDefinitionError = true;
|
||||
shape->setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ void TriggerStimulatorHelper::assertSyncPositionAndSetDutyCycle(const uint32_t s
|
|||
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);
|
||||
shape->shapeDefinitionError = true;
|
||||
shape->setShapeDefinitionError(true);
|
||||
return;
|
||||
}
|
||||
shape->shapeDefinitionError = false;
|
||||
|
@ -117,7 +117,7 @@ uint32_t TriggerStimulatorHelper::findTriggerSyncPoint(TriggerShape * shape,
|
|||
if (state->shaft_is_synchronized)
|
||||
return i;
|
||||
}
|
||||
engine->triggerCentral.triggerShape.shapeDefinitionError = 1;
|
||||
engine->triggerCentral.triggerShape.setShapeDefinitionError(true);
|
||||
warning(CUSTOM_ERR_TRIGGER_SYNC, "findTriggerZeroEventIndex() failed");
|
||||
return EFI_ERROR_CODE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue