per error code

This commit is contained in:
rusEfi 2018-07-23 21:38:05 -04:00
parent f62f9563d3
commit 4ae468e7d3
10 changed files with 26 additions and 16 deletions

View File

@ -153,7 +153,7 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle += getAdvanceCorrections(rpm PASS_ENGINE_PARAMETER_SUFFIX);
}
angle -= engineConfiguration->ignitionOffset;
fixAngle(angle, "getAdvance");
fixAngle(angle, "getAdvance", CUSTOM_ERR_6548);
return angle;
}

View File

@ -111,7 +111,7 @@ angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
efiAssert(!cisnan(value), "inj offset#1", 0);
angle_t result = value + CONFIG(extraInjectionOffset);
fixAngle(result, "inj offset#2");
fixAngle(result, "inj offset#2", CUSTOM_ERR_6553);
return result;
}

View File

@ -1919,6 +1919,16 @@ typedef enum {
CUSTOM_ERR_6558 = 6557,
CUSTOM_ERR_6559 = 6559,
CUSTOM_ERR_6560 = 6560,
CUSTOM_ERR_6561 = 6561,
CUSTOM_ERR_6562 = 6562,
CUSTOM_ERR_6563 = 6563,
CUSTOM_ERR_6564 = 6564,
CUSTOM_ERR_6565 = 6565,
CUSTOM_ERR_6566 = 6566,
CUSTOM_ERR_6567 = 6567,
CUSTOM_ERR_6568 = 6567,
CUSTOM_ERR_6569 = 6569,
// this is needed for proper enum size, this matters for malfunction_central
Internal_ForceMyEnumIntSize_cranking_obd_code = ENUM_32_BITS,

View File

@ -232,7 +232,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
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, "cylinderStart");
fixAngle(cylinderStart, "cylinderStart", CUSTOM_ERR_6562);
engine->engineState.mapAveragingStart[i] = cylinderStart;
}
engine->engineState.mapAveragingDuration = interpolate2d("samp", rpm, c->samplingWindowBins, c->samplingWindow, MAP_WINDOW_SIZE);
@ -288,7 +288,7 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
}
fixAngle(samplingEnd, "samplingEnd");
fixAngle(samplingEnd, "samplingEnd", CUSTOM_ERR_6563);
// only if value is already prepared
int structIndex = getRevolutionCounter() % 2;
// todo: schedule this based on closest trigger event, same as ignition works

View File

@ -193,7 +193,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
ev->engine = engine;
#endif
fixAngle(angle, "addFuel#1");
fixAngle(angle, "addFuel#1", CUSTOM_ERR_6554);
ev->outputs[0] = output;
ev->outputs[1] = secondOutput;
@ -304,7 +304,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position, angle
// convert engine cycle angle into trigger cycle angle
angleOffset += tdcPosition();
efiAssertVoid(!cisnan(angleOffset), "findAngle#2");
fixAngle(angleOffset, "addFuel#2");
fixAngle(angleOffset, "addFuel#2", CUSTOM_ERR_6555);
int index = triggerIndexByAngle[(int)angleOffset];
angle_t eventAngle = eventAngles[index];

View File

@ -32,13 +32,13 @@ void setFlatInjectorLag(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
* @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, msg) \
#define fixAngle(angle, msg, code) \
{ \
if (cisnan(angle)) { \
firmwareError(CUSTOM_ERR_ANGLE, "angle NaN %s", msg); \
firmwareError(CUSTOM_ERR_ANGLE, "aNaN%s", msg); \
angle = 0; \
} \
assertAngleRange(angle, msg, CUSTOM_ERR_6548); \
assertAngleRange(angle, msg, code); \
float engineCycleDurationLocalCopy = ENGINE(engineCycle); \
/* todo: split this method into 'fixAngleUp' and 'fixAngleDown'*/ \
/* as a performance optimization?*/ \

View File

@ -62,12 +62,12 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
*/
angle_t extra = phaseIndex * 360 + valveIndex * 180;
angle_t onTime = extra + engine->engineState.auxValveStart;
fixAngle(onTime, "onTime");
fixAngle(onTime, "onTime", CUSTOM_ERR_6556);
scheduleByAngle(rpm, &turnOnEvent[valveIndex][phaseIndex],
onTime,
(schfunc_t) &turnOn, output, &engine->rpmCalculator);
angle_t offTime = extra + engine->engineState.auxValveEnd;
fixAngle(offTime, "offTime");
fixAngle(offTime, "offTime", CUSTOM_ERR_6557);
scheduleByAngle(rpm, &turnOffEvent[valveIndex][phaseIndex],
offTime,
(schfunc_t) &turnOff, output, &engine->rpmCalculator);

View File

@ -134,7 +134,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
// convert engine cycle angle into trigger cycle angle
vvtPosition -= tdcPosition();
fixAngle(vvtPosition, "vvtPosition");
fixAngle(vvtPosition, "vvtPosition", CUSTOM_ERR_6558);
tc->vvtPosition = (engineConfiguration->vvtDisplayInverted ? -vvtPosition : vvtPosition) + engineConfiguration->vvtOffset;

View File

@ -82,7 +82,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;
float angle = getAngle(triggerDefinitionCoordinate) - firstAngle;
efiAssertVoid(!cisnan(angle), "trgSyncNaN");
fixAngle(angle, "trgSync");
fixAngle(angle, "trgSync", CUSTOM_ERR_6559);
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
if (isFrontEvent[triggerDefinitionIndex]) {
frontOnlyIndex += 2;
@ -201,7 +201,7 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndex, efi
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[current_index]);
// todo: make this '90' depend on cylinder count or trigger shape?
angle_t previousAngle = currentAngle - 90;
fixAngle(previousAngle, "prevAngle");
fixAngle(previousAngle, "prevAngle", CUSTOM_ERR_6560);
// todo: prevIndex should be pre-calculated
*prevIndex = TRIGGER_SHAPE(triggerIndexByAngle[(int)previousAngle]);
@ -210,7 +210,7 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndex, efi
uint32_t time = nowNt - timeOfLastEvent[*prevIndex];
angle_t angleDiff = currentAngle - prevIndexAngle;
// todo: angle diff should be pre-calculated
fixAngle(angleDiff, "angleDiff");
fixAngle(angleDiff, "angleDiff", CUSTOM_ERR_6561);
// just for safety
if (time == 0)

View File

@ -245,7 +245,7 @@ static void reportWave(Logging *logging, int index) {
appendPrintf(logging, "advance%d%s", index, DELIMETER);
float angle = (offsetUs / oneDegreeUs) - tdcPosition();
fixAngle(angle, "waveAn");
fixAngle(angle, "waveAn", CUSTOM_ERR_6564);
appendFloat(logging, angle, 3);
appendPrintf(logging, "%s", DELIMETER);
}