auto-sync
This commit is contained in:
parent
efec553f36
commit
0f7c5af2d2
|
@ -129,6 +129,7 @@ static void setIdleValvePosition(int positionPercent) {
|
||||||
|
|
||||||
static int idlePositionBeforeBlip;
|
static int idlePositionBeforeBlip;
|
||||||
static efitimeus_t timeToStopBlip = 0;
|
static efitimeus_t timeToStopBlip = 0;
|
||||||
|
static efitimeus_t timeToStopIdleTest = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I use this questionable feature to tune acceleration enrichment
|
* I use this questionable feature to tune acceleration enrichment
|
||||||
|
@ -143,6 +144,11 @@ static void blipIdle(int idlePosition, int durationMs) {
|
||||||
timeToStopBlip = getTimeNowUs() + 1000 * durationMs;
|
timeToStopBlip = getTimeNowUs() + 1000 * durationMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void finishIdleTestIfNeeded() {
|
||||||
|
if (timeToStopIdleTest != 0 && getTimeNowUs() > timeToStopIdleTest)
|
||||||
|
timeToStopIdleTest = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void undoIdleBlipIfNeeded() {
|
static void undoIdleBlipIfNeeded() {
|
||||||
if (timeToStopBlip != 0 && getTimeNowUs() > timeToStopBlip) {
|
if (timeToStopBlip != 0 && getTimeNowUs() > timeToStopBlip) {
|
||||||
timeToStopBlip = 0;
|
timeToStopBlip = 0;
|
||||||
|
@ -177,6 +183,7 @@ static msg_t ivThread(int param) {
|
||||||
getHwPin(boardConfiguration->clutchUpPin));
|
getHwPin(boardConfiguration->clutchUpPin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishIdleTestIfNeeded();
|
||||||
undoIdleBlipIfNeeded();
|
undoIdleBlipIfNeeded();
|
||||||
|
|
||||||
if (engineConfiguration->idleMode != IM_AUTO) {
|
if (engineConfiguration->idleMode != IM_AUTO) {
|
||||||
|
@ -235,6 +242,10 @@ static void setIdleDT(int value) {
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void startIdleBench(void) {
|
||||||
|
timeToStopIdleTest = getTimeNowUs() + MS2US(3000); // 3 seconds
|
||||||
|
}
|
||||||
|
|
||||||
void setDefaultIdleParameters(void) {
|
void setDefaultIdleParameters(void) {
|
||||||
engineConfiguration->idlePid.pFactor = 0.1f;
|
engineConfiguration->idlePid.pFactor = 0.1f;
|
||||||
engineConfiguration->idlePid.iFactor = 0.05f;
|
engineConfiguration->idlePid.iFactor = 0.05f;
|
||||||
|
@ -247,7 +258,9 @@ static void applyIdleSolenoidPinState(PwmConfig *state, int stateIndex) {
|
||||||
efiAssertVoid(state->multiWave.waveCount == 1, "invalid idle waveCount");
|
efiAssertVoid(state->multiWave.waveCount == 1, "invalid idle waveCount");
|
||||||
OutputPin *output = state->outputPins[0];
|
OutputPin *output = state->outputPins[0];
|
||||||
int value = state->multiWave.waves[0].pinStates[stateIndex];
|
int value = state->multiWave.waves[0].pinStates[stateIndex];
|
||||||
if (!value || engine->rpmCalculator.rpmValue != 0)
|
if (!value /* always allow tuning solenoid down */ ||
|
||||||
|
(engine->rpmCalculator.rpmValue != 0 || timeToStopIdleTest != 0) /* do not run solenoid unless engine is spinning or bench testing in progress */
|
||||||
|
)
|
||||||
output->setValue(value);
|
output->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +316,7 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
|
||||||
addConsoleActionF("set_idle_d", setIdleDFactor);
|
addConsoleActionF("set_idle_d", setIdleDFactor);
|
||||||
addConsoleActionI("set_idle_dt", setIdleDT);
|
addConsoleActionI("set_idle_dt", setIdleDT);
|
||||||
|
|
||||||
|
addConsoleAction("idlebench", startIdleBench);
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue