Hellen says merge #1772 main relay progress

This commit is contained in:
rusefi 2020-09-10 21:08:39 -04:00
parent fe3d03ba5a
commit e0ab0456d8
2 changed files with 17 additions and 1 deletions

View File

@ -286,7 +286,9 @@ void Engine::OnTriggerStateProperState(efitick_t nowNt) {
Engine *engine = this; Engine *engine = this;
EXPAND_Engine; EXPAND_Engine;
#if EFI_SHAFT_POSITION_INPUT
triggerCentral.triggerState.runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX); triggerCentral.triggerState.runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
#endif /* EFI_SHAFT_POSITION_INPUT */
rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX); rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
} }
@ -542,6 +544,8 @@ void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// let's close injectors or else if these happen to be open right now // let's close injectors or else if these happen to be open right now
enginePins.stopPins(); enginePins.stopPins();
// todo: initiate stepper motor parking // todo: initiate stepper motor parking
// make sure we have stored all the info
backupRamFlush();
} }
void action_s::execute() { void action_s::execute() {

View File

@ -139,8 +139,13 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
case LE_METHOD_EXHAUST_VVT: case LE_METHOD_EXHAUST_VVT:
return engine->triggerCentral.vvtPosition; return engine->triggerCentral.vvtPosition;
case LE_METHOD_TIME_SINCE_BOOT: case LE_METHOD_TIME_SINCE_BOOT:
#if EFI_MAIN_RELAY_CONTROL
// in main relay control mode, we return the number of seconds since the ignition is turned on
// (or negative if the ignition key is switched off)
return engine->getTimeIgnitionSeconds();
#else
return getTimeNowSeconds(); return getTimeNowSeconds();
#endif /* EFI_MAIN_RELAY_CONTROL */
case LE_METHOD_STARTUP_FUEL_PUMP_DURATION: case LE_METHOD_STARTUP_FUEL_PUMP_DURATION:
return engineConfiguration->startUpFuelPumpDuration; return engineConfiguration->startUpFuelPumpDuration;
@ -456,6 +461,7 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_MAIN_RELAY_CONTROL #if EFI_MAIN_RELAY_CONTROL
if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED)
// the MAIN_RELAY_LOGIC calls engine->isInShutdownMode()
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
#else /* EFI_MAIN_RELAY_CONTROL */ #else /* EFI_MAIN_RELAY_CONTROL */
/** /**
@ -738,6 +744,12 @@ extern EnginePins enginePins;
// "Limp-mode" implementation for some RAM-limited configs without FSIO // "Limp-mode" implementation for some RAM-limited configs without FSIO
void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_PROD_CODE
if (isRunningBenchTest()) {
return; // let's not mess with bench testing
}
#endif /* EFI_PROD_CODE */
// see MAIN_RELAY_LOGIC // see MAIN_RELAY_LOGIC
if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) {
enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode()); enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode());