start/stop button improvements #6483

only: more progress!
This commit is contained in:
Andrey 2024-05-08 23:08:40 -04:00
parent 525570f896
commit 7717f4dfdc
1 changed files with 4 additions and 1 deletions

View File

@ -51,13 +51,16 @@ static void disengageStarterIfNeeded() {
void slowStartStopButtonCallback() {
if (!isIgnVoltage()) {
// nothing to crank if we are powered only via USB
engine->startStopState.timeSinceIgnitionPower.reset();
return;
} else if (engine->startStopState.isFirstTime) {
// initialize when first time with proper power
engine->startStopState.timeSinceIgnitionPower.reset();
engine->startStopState.isFirstTime = false;
}
if (getTimeNowMs() < engineConfiguration->startButtonSuppressOnStartUpMs) {
if (engine->startStopState.timeSinceIgnitionPower.getElapsedUs() < MS2US(engineConfiguration->startButtonSuppressOnStartUpMs)) {
// where are odd cases of start button combined with ECU power source button we do not want to crank right on start
return;
}