mirror of https://github.com/FOME-Tech/fome-fw.git
change to log base timing
This commit is contained in:
parent
32882c6eff
commit
41339c5418
|
@ -530,10 +530,6 @@ static void updateFuelInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateIgnition(int rpm) {
|
static void updateIgnition(int rpm) {
|
||||||
float timing = engine->engineState.timingAdvance[0];
|
|
||||||
// that's weird logic. also seems broken for two stroke?
|
|
||||||
engine->outputChannels.ignitionAdvance = timing > FOUR_STROKE_CYCLE_DURATION / 2 ? timing - FOUR_STROKE_CYCLE_DURATION : timing;
|
|
||||||
|
|
||||||
engine->outputChannels.coilDutyCycle = getCoilDutyCycle(rpm);
|
engine->outputChannels.coilDutyCycle = getCoilDutyCycle(rpm);
|
||||||
|
|
||||||
engine->outputChannels.knockCount = engine->module<KnockController>()->getKnockCount();
|
engine->outputChannels.knockCount = engine->module<KnockController>()->getKnockCount();
|
||||||
|
|
|
@ -160,6 +160,9 @@ void EngineState::periodicFastCallback() {
|
||||||
float ignitionLoad = getIgnitionLoad();
|
float ignitionLoad = getIgnitionLoad();
|
||||||
float advance = getAdvance(rpm, ignitionLoad) * engine->ignitionState.luaTimingMult + engine->ignitionState.luaTimingAdd;
|
float advance = getAdvance(rpm, ignitionLoad) * engine->ignitionState.luaTimingMult + engine->ignitionState.luaTimingAdd;
|
||||||
|
|
||||||
|
// that's weird logic. also seems broken for two stroke?
|
||||||
|
engine->outputChannels.ignitionAdvance = (float)(advance > FOUR_STROKE_CYCLE_DURATION / 2 ? advance - FOUR_STROKE_CYCLE_DURATION : advance);
|
||||||
|
|
||||||
// compute per-bank fueling
|
// compute per-bank fueling
|
||||||
for (size_t i = 0; i < STFT_BANK_COUNT; i++) {
|
for (size_t i = 0; i < STFT_BANK_COUNT; i++) {
|
||||||
float corr = clResult.banks[i];
|
float corr = clResult.banks[i];
|
||||||
|
|
|
@ -80,23 +80,30 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
||||||
// let's save planned duration so that we can later compare it with reality
|
// let's save planned duration so that we can later compare it with reality
|
||||||
event->sparkDwell = sparkDwell;
|
event->sparkDwell = sparkDwell;
|
||||||
|
|
||||||
|
// Compute the final ignition timing including all "late" adjustments
|
||||||
|
angle_t finalIgnitionTiming = getEngineState()->timingAdvance[event->cylinderNumber]
|
||||||
|
// Pull any extra timing for knock retard
|
||||||
|
- engine->module<KnockController>()->getKnockRetard();
|
||||||
|
|
||||||
|
// TODO: Log "true" per-cylinder timing here #76
|
||||||
|
//engine->outputChannels......[event->cylinderNumber] = finalIgnitionTiming;
|
||||||
|
|
||||||
angle_t sparkAngle =
|
angle_t sparkAngle =
|
||||||
// Negate because timing *before* TDC, and we schedule *after* TDC
|
// Negate because timing *before* TDC, and we schedule *after* TDC
|
||||||
- getEngineState()->timingAdvance[event->cylinderNumber]
|
- finalIgnitionTiming
|
||||||
// Offset by this cylinder's position in the cycle
|
// Offset by this cylinder's position in the cycle
|
||||||
+ getCylinderAngle(event->cylinderIndex, event->cylinderNumber)
|
+ getCylinderAngle(event->cylinderIndex, event->cylinderNumber);
|
||||||
// Pull any extra timing for knock retard
|
|
||||||
+ engine->module<KnockController>()->getKnockRetard();
|
|
||||||
|
|
||||||
efiAssertVoid(ObdCode::CUSTOM_SPARK_ANGLE_1, !cisnan(sparkAngle), "sparkAngle#1");
|
efiAssertVoid(ObdCode::CUSTOM_SPARK_ANGLE_1, !cisnan(sparkAngle), "sparkAngle#1");
|
||||||
|
wrapAngle2(sparkAngle, "findAngle#2", ObdCode::CUSTOM_ERR_6550, getEngineCycle(getEngineRotationState()->getOperationMode()));
|
||||||
|
event->sparkAngle = sparkAngle;
|
||||||
|
|
||||||
auto ignitionMode = getCurrentIgnitionMode();
|
auto ignitionMode = getCurrentIgnitionMode();
|
||||||
engine->outputChannels.currentIgnitionMode = static_cast<uint8_t>(ignitionMode);
|
engine->outputChannels.currentIgnitionMode = static_cast<uint8_t>(ignitionMode);
|
||||||
|
|
||||||
const int index = getIgnitionPinForIndex(event->cylinderIndex, ignitionMode);
|
const int index = getIgnitionPinForIndex(event->cylinderIndex, ignitionMode);
|
||||||
const int coilIndex = ID2INDEX(getCylinderId(index));
|
const int coilIndex = ID2INDEX(getCylinderId(index));
|
||||||
IgnitionOutputPin *output = &enginePins.coils[coilIndex];
|
event->outputs[0] = &enginePins.coils[coilIndex];
|
||||||
|
|
||||||
IgnitionOutputPin *secondOutput;
|
IgnitionOutputPin *secondOutput;
|
||||||
|
|
||||||
// If wasted spark, find the paired coil in addition to "main" output for this cylinder
|
// If wasted spark, find the paired coil in addition to "main" output for this cylinder
|
||||||
|
@ -108,11 +115,8 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
||||||
secondOutput = nullptr;
|
secondOutput = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
event->outputs[0] = output;
|
|
||||||
event->outputs[1] = secondOutput;
|
event->outputs[1] = secondOutput;
|
||||||
|
|
||||||
wrapAngle2(sparkAngle, "findAngle#2", ObdCode::CUSTOM_ERR_6550, getEngineCycle(getEngineRotationState()->getOperationMode()));
|
|
||||||
event->sparkAngle = sparkAngle;
|
|
||||||
// Stash which cylinder we're scheduling so that knock sensing knows which
|
// Stash which cylinder we're scheduling so that knock sensing knows which
|
||||||
// cylinder just fired
|
// cylinder just fired
|
||||||
event->cylinderNumber = coilIndex;
|
event->cylinderNumber = coilIndex;
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
#define GAUGE_NAME_LAMBDA2 "Lambda 2"
|
#define GAUGE_NAME_LAMBDA2 "Lambda 2"
|
||||||
#define GAUGE_NAME_IAC "Idle: Position"
|
#define GAUGE_NAME_IAC "Idle: Position"
|
||||||
|
|
||||||
#define GAUGE_NAME_TIMING_ADVANCE "Ign: Timing"
|
#define GAUGE_NAME_TIMING_ADVANCE "Ign: Timing Base"
|
||||||
#define GAUGE_NAME_DWELL_DUTY "Ign: Coil duty cycle"
|
#define GAUGE_NAME_DWELL_DUTY "Ign: Coil duty cycle"
|
||||||
#define GAUGE_COIL_DWELL_TIME "Ign: Dwell"
|
#define GAUGE_COIL_DWELL_TIME "Ign: Dwell"
|
||||||
#define GAUGE_NAME_IGNITION_LOAD "Ign: Load"
|
#define GAUGE_NAME_IGNITION_LOAD "Ign: Load"
|
||||||
|
|
Loading…
Reference in New Issue