Something kia rio starter 4chan #5701

last step before debugger?
This commit is contained in:
rusefi 2023-11-08 21:04:25 -05:00
parent 84bd6dc277
commit 0d43df3aec
2 changed files with 9 additions and 0 deletions

View File

@ -40,6 +40,7 @@ struct_no_prefix engine_state_s
int8_t startStopState
bit startStopPhysicalState
uint32_t startStopStateToggleCounter
uint32_t startStopStateTempPhysicalCounter
float egtValue1
float egtValue2

View File

@ -47,6 +47,9 @@ static void disengageStarterIfNeeded() {
}
}
static int prevPhysicalState = 0;
static int currentPhysicalState = 0;
void slowStartStopButtonCallback() {
if (getTimeNowMs() < engineConfiguration->startButtonSuppressOnStartUpMs) {
// where are odd cases of start button combined with ECU power source button we do not want to crank right on start
@ -62,6 +65,11 @@ void slowStartStopButtonCallback() {
}
engine->engineState.startStopState = startStopState;
engine->engineState.startStopPhysicalState = startStopButtonDebounce.getPhysicalState();
currentPhysicalState = startStopButtonDebounce.getPhysicalState();
if (currentPhysicalState != prevPhysicalState) {
engine->engineState.startStopStateTempPhysicalCounter++;
}
prevPhysicalState = currentPhysicalState;
bool isStarterEngaged = enginePins.starterControl.getLogicValue();