auto-sync
This commit is contained in:
parent
1ae9149e60
commit
2baaae64e7
|
@ -100,7 +100,7 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {
|
|||
}
|
||||
}
|
||||
angle -= engineConfiguration->ignitionOffset;
|
||||
fixAngle(angle);
|
||||
fixAngle(angle, "getAdvance");
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_F) {
|
|||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
angle_t cylinderOffset = getEngineCycle(engineConfiguration->operationMode) * i / engineConfiguration->specs.cylindersCount;
|
||||
float cylinderStart = start + cylinderOffset - offsetAngle + tdcPosition();
|
||||
fixAngle(cylinderStart);
|
||||
fixAngle(cylinderStart, "cylinderStart");
|
||||
engine->engineState.mapAveragingStart[i] = cylinderStart;
|
||||
}
|
||||
engine->engineState.mapAveragingDuration = interpolate2d(rpm, c->samplingWindowBins, c->samplingWindow, MAP_WINDOW_SIZE);
|
||||
|
|
|
@ -89,7 +89,7 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
angle_t getinjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||
angle_t result = fuelPhaseMap.getValue(rpm, engineLoad) + CONFIG(extraInjectionOffset);
|
||||
fixAngle(result);
|
||||
fixAngle(result, "inj offset");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ static void mapAveragingCallback(trigger_event_e ckpEventType,
|
|||
}
|
||||
|
||||
angle_t samplingEnd = samplingStart + samplingDuration;
|
||||
fixAngle(samplingEnd);
|
||||
fixAngle(samplingEnd, "samplingEnd");
|
||||
if (!cisnan(samplingEnd)) {
|
||||
// only if value is already prepared
|
||||
int structIndex = getRevolutionCounter() % 2;
|
||||
|
|
|
@ -165,7 +165,7 @@ void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
|
|||
#if EFI_UNIT_TEST
|
||||
ev->engine = engine;
|
||||
#endif
|
||||
fixAngle(angle);
|
||||
fixAngle(angle, "addFuel#1");
|
||||
|
||||
ev->outputs[0] = output;
|
||||
ev->outputs[1] = secondOutput;
|
||||
|
@ -257,7 +257,7 @@ static int findAngleIndex(float target DECLARE_ENGINE_PARAMETER_S) {
|
|||
void findTriggerPosition(event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S) {
|
||||
// convert engine cycle angle into trigger cycle angle
|
||||
angleOffset += tdcPosition();
|
||||
fixAngle(angleOffset);
|
||||
fixAngle(angleOffset, "addFuel#2");
|
||||
|
||||
int index = TRIGGER_SHAPE(triggerIndexByAngle[(int)angleOffset]);
|
||||
angle_t eventAngle = TRIGGER_SHAPE(eventAngles[index]);
|
||||
|
|
|
@ -20,9 +20,9 @@ void findTriggerPosition(
|
|||
event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#if EFI_ENABLE_ASSERTS
|
||||
#define assertAngleRange(angle) if(angle > 10000000 || angle < -10000000) { firmwareError(OBD_PCM_Processor_Fault, "angle range");angle = 0;}
|
||||
#define assertAngleRange(angle, msg) if(angle > 10000000 || angle < -10000000) { firmwareError(OBD_PCM_Processor_Fault, "angle range %s %f", angle, msg);angle = 0;}
|
||||
#else
|
||||
#define assertAngleRange(angle) {}
|
||||
#define assertAngleRange(angle, msg) {}
|
||||
#endif
|
||||
|
||||
void setInjectorLag(float value DECLARE_ENGINE_PARAMETER_S);
|
||||
|
@ -32,9 +32,9 @@ void setInjectorLag(float value DECLARE_ENGINE_PARAMETER_S);
|
|||
* @brief Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
|
||||
* I guess this implementation would be faster than 'angle % engineCycle'
|
||||
*/
|
||||
#define fixAngle(angle) \
|
||||
#define fixAngle(angle, msg) \
|
||||
{ \
|
||||
assertAngleRange(angle); \
|
||||
assertAngleRange(angle, msg); \
|
||||
float engineCycleDurationLocalCopy = ENGINE(engineCycle); \
|
||||
/* todo: split this method into 'fixAngleUp' and 'fixAngleDown'*/ \
|
||||
/* as a performance optimization?*/ \
|
||||
|
|
|
@ -120,7 +120,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
|
|||
|
||||
// convert engine cycle angle into trigger cycle angle
|
||||
vvtPosition -= tdcPosition();
|
||||
fixAngle(vvtPosition);
|
||||
fixAngle(vvtPosition, "vvtPosition");
|
||||
|
||||
tc->vvtPosition = vvtPosition + engineConfiguration->vvtOffset;
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
||||
// todo: make this '90' depend on cylinder count?
|
||||
angle_t prevAngle = currentAngle - 90;
|
||||
fixAngle(prevAngle);
|
||||
fixAngle(prevAngle, "prevAngle");
|
||||
// todo: prevIndex should be pre-calculated
|
||||
int prevIndex = TRIGGER_SHAPE(triggerIndexByAngle[(int)prevAngle]);
|
||||
// now let's get precise angle for that event
|
||||
|
@ -332,7 +332,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
// uint32_t time = nowNt - timeOfLastEvent[prevIndex];
|
||||
angle_t angleDiff = currentAngle - prevAngle;
|
||||
// todo: angle diff should be pre-calculated
|
||||
fixAngle(angleDiff);
|
||||
fixAngle(angleDiff, "angleDiff");
|
||||
|
||||
// float r = (60000000.0 / 360 * US_TO_NT_MULTIPLIER) * angleDiff / time;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
|
|||
int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
|
||||
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;
|
||||
float angle = getAngle(triggerDefinitionCoordinate) - firstAngle;
|
||||
fixAngle(angle);
|
||||
fixAngle(angle, "trgSync");
|
||||
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
|
||||
if (isFrontEvent[triggerDefinitionIndex]) {
|
||||
frontOnlyIndex += 2;
|
||||
|
|
|
@ -243,7 +243,7 @@ static void reportWave(Logging *logging, int index) {
|
|||
|
||||
appendPrintf(logging, "advance%d%s", index, DELIMETER);
|
||||
float angle = (offsetUs / oneDegreeUs) - tdcPosition();
|
||||
fixAngle(angle);
|
||||
fixAngle(angle, "angle");
|
||||
appendFloat(logging, angle, 3);
|
||||
appendPrintf(logging, "%s", DELIMETER);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue