odd fire timing_offset_cylinder not accounted by injection revert #6095
revert of revert, we have timing accounted by fuel again!
This commit is contained in:
parent
4c0bf9c070
commit
143170d60c
|
@ -209,11 +209,7 @@ angle_t getAdvance(int rpm, float engineLoad) {
|
|||
}
|
||||
|
||||
angle_t getCylinderIgnitionTrim(size_t cylinderNumber, int rpm, float ignitionLoad) {
|
||||
// we have two separate per-cylinder trims, that's a feature
|
||||
// Plus or minus any adjustment if this is an odd-fire engine
|
||||
auto adjustment = engineConfiguration->timing_offset_cylinder[cylinderNumber];
|
||||
|
||||
return -adjustment + interpolate3d(
|
||||
return interpolate3d(
|
||||
config->ignTrims[cylinderNumber].table,
|
||||
config->ignTrimLoadBins, ignitionLoad,
|
||||
config->ignTrimRpmBins, rpm
|
||||
|
|
|
@ -420,14 +420,18 @@ void prepareOutputSignals() {
|
|||
}
|
||||
|
||||
angle_t getPerCylinderFiringOrderOffset(uint8_t cylinderIndex, uint8_t cylinderNumber) {
|
||||
UNUSED(cylinderNumber); // TODO: technical debt
|
||||
// base = position of this cylinder in the firing order.
|
||||
// We get a cylinder every n-th of an engine cycle where N is the number of cylinders
|
||||
auto firingOrderOffset = engine->engineState.engineCycle * cylinderIndex / engineConfiguration->cylindersCount;
|
||||
|
||||
assertAngleRange(firingOrderOffset, "getPerCylinderFiringOrderOffset", ObdCode::CUSTOM_ERR_CYL_ANGLE);
|
||||
// Plus or minus any adjustment if this is an odd-fire engine
|
||||
auto adjustment = engineConfiguration->timing_offset_cylinder[cylinderNumber];
|
||||
|
||||
return firingOrderOffset;
|
||||
auto result = firingOrderOffset + adjustment;
|
||||
|
||||
assertAngleRange(result, "getCylinderAngle", ObdCode::CUSTOM_ERR_CYL_ANGLE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void setTimingRpmBin(float from, float to) {
|
||||
|
|
|
@ -61,8 +61,8 @@ TEST(OddFireRunningMode, hd) {
|
|||
ASSERT_NEAR(0.0069257142022, getInjectionMass(200), EPS3D);
|
||||
|
||||
ASSERT_EQ( 8, engine->executor.size());
|
||||
eth.assertEvent5("fuel down2#1", 1, (void*)turnInjectionPinLow, eth.angleToTimeUs(180 + PORT_INJECTION_OFFSET));
|
||||
eth.assertEvent5("fuel down2#1", 1, (void*)turnInjectionPinLow, eth.angleToTimeUs(180 + PORT_INJECTION_OFFSET + cylinderOne));
|
||||
eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing));
|
||||
eth.assertEvent5("fuel down2#5", 5, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET));
|
||||
eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo));
|
||||
eth.assertEvent5("spark down2#7", 7, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(180 + cylinderOne - timing));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue