move swtiches out of idle (#2148)
This commit is contained in:
parent
4ebae44888
commit
5e7dc71365
|
@ -471,32 +471,6 @@ static percent_t automaticIdleController(float tpsPos, float rpm, int targetRpm
|
|||
wasResetPid = true;
|
||||
}
|
||||
|
||||
|
||||
#if EFI_GPIO_HARDWARE
|
||||
// this value is not used yet
|
||||
if (CONFIG(clutchDownPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchDownState = efiReadPin(CONFIG(clutchDownPin));
|
||||
}
|
||||
if (hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
bool result = getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
if (engine->acSwitchState != result) {
|
||||
engine->acSwitchState = result;
|
||||
engine->acSwitchLastChangeTime = getTimeNowUs();
|
||||
}
|
||||
engine->acSwitchState = result;
|
||||
}
|
||||
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchUpState = efiReadPin(CONFIG(clutchUpPin));
|
||||
}
|
||||
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->engineState.idle.throttlePedalUpState = efiReadPin(CONFIG(throttlePedalUpPin));
|
||||
}
|
||||
|
||||
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {
|
||||
engine->brakePedalState = efiReadPin(engineConfiguration->brakePedalPin);
|
||||
}
|
||||
#endif /* EFI_GPIO_HARDWARE */
|
||||
|
||||
finishIdleTestIfNeeded();
|
||||
undoIdleBlipIfNeeded();
|
||||
|
||||
|
|
|
@ -246,6 +246,8 @@ extern float vBattForTle8888;
|
|||
* See also periodicFastCallback
|
||||
*/
|
||||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
updateSwitchInputs(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
int rpm = GET_RPM();
|
||||
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
||||
|
@ -273,6 +275,33 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Engine::updateSwitchInputs(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
#if EFI_GPIO_HARDWARE
|
||||
// this value is not used yet
|
||||
if (CONFIG(clutchDownPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchDownState = efiReadPin(CONFIG(clutchDownPin));
|
||||
}
|
||||
if (hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
bool result = getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
if (engine->acSwitchState != result) {
|
||||
engine->acSwitchState = result;
|
||||
engine->acSwitchLastChangeTime = getTimeNowUs();
|
||||
}
|
||||
engine->acSwitchState = result;
|
||||
}
|
||||
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->clutchUpState = efiReadPin(CONFIG(clutchUpPin));
|
||||
}
|
||||
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
|
||||
engine->engineState.idle.throttlePedalUpState = efiReadPin(CONFIG(throttlePedalUpPin));
|
||||
}
|
||||
|
||||
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {
|
||||
engine->brakePedalState = efiReadPin(engineConfiguration->brakePedalPin);
|
||||
}
|
||||
#endif // EFI_GPIO_HARDWARE
|
||||
}
|
||||
|
||||
void Engine::onTriggerSignalEvent(efitick_t nowNt) {
|
||||
isSpinning = true;
|
||||
lastTriggerToothEventTimeNt = nowNt;
|
||||
|
|
|
@ -252,6 +252,7 @@ public:
|
|||
void periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void updateSwitchInputs(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void initializeTriggerWaveform(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
bool clutchUpState = false;
|
||||
|
|
Loading…
Reference in New Issue