From 56dc0177575f7ae8c528da8fd5363b8f754913d1 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 10 Sep 2020 21:08:39 -0400 Subject: [PATCH 1/4] Hellen says merge #1772 main relay progress --- firmware/controllers/algo/engine.cpp | 4 ++++ firmware/controllers/core/fsio_impl.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 7296a347ea..366e93d216 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -286,7 +286,9 @@ void Engine::OnTriggerStateProperState(efitick_t nowNt) { Engine *engine = this; EXPAND_Engine; +#if EFI_SHAFT_POSITION_INPUT triggerCentral.triggerState.runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX); +#endif /* EFI_SHAFT_POSITION_INPUT */ 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 enginePins.stopPins(); // todo: initiate stepper motor parking + // make sure we have stored all the info + backupRamFlush(); } void action_s::execute() { diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 94098df728..bc0d4e0e5f 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -139,8 +139,13 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) { case LE_METHOD_EXHAUST_VVT: return engine->triggerCentral.vvtPosition; 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(); - +#endif /* EFI_MAIN_RELAY_CONTROL */ case LE_METHOD_STARTUP_FUEL_PUMP_DURATION: return engineConfiguration->startUpFuelPumpDuration; @@ -456,6 +461,7 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_MAIN_RELAY_CONTROL if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) + // the MAIN_RELAY_LOGIC calls engine->isInShutdownMode() setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); #else /* EFI_MAIN_RELAY_CONTROL */ /** @@ -738,6 +744,12 @@ extern EnginePins enginePins; // "Limp-mode" implementation for some RAM-limited configs without FSIO 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 if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) { enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode()); From 4a06a67f60eb248718fb7ed447e988df6406ab84 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 10 Sep 2020 21:09:19 -0400 Subject: [PATCH 2/4] Hellen says merge #1772 getting closer? --- firmware/config/boards/STM32F407VET6_Hellen_STM.bat | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 firmware/config/boards/STM32F407VET6_Hellen_STM.bat diff --git a/firmware/config/boards/STM32F407VET6_Hellen_STM.bat b/firmware/config/boards/STM32F407VET6_Hellen_STM.bat new file mode 100644 index 0000000000..795655ddf1 --- /dev/null +++ b/firmware/config/boards/STM32F407VET6_Hellen_STM.bat @@ -0,0 +1,11 @@ + +echo "Compiling for Hellen-STM" +cd ../.. +rem TODO: somehow this -DDUMMY is helping us to not mess up the parameters, why?! +rem https://github.com/rusefi/rusefi/issues/684 +set EXTRA_PARAMS="-DDUMMY -DEFI_COMMUNICATION_PIN=GPIOD_13 -DEFI_WARNING_PIN=GPIOA_9 -DEFI_RUNNING_PIN=GPIOD_14 -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS" +set DEBUG_LEVEL_OPT="-O2" + +rem make -r -j4 clean + +call config/boards/common_make.bat From d33afbc0d13d22a10ae4fc8464de9a436bac4af2 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 10 Sep 2020 21:09:56 -0400 Subject: [PATCH 3/4] Hellen says merge #1772 system fsio --- firmware/controllers/system_fsio.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/system_fsio.txt b/firmware/controllers/system_fsio.txt index 8a6148ca9f..2074e7119b 100644 --- a/firmware/controllers/system_fsio.txt +++ b/firmware/controllers/system_fsio.txt @@ -9,9 +9,9 @@ # Andrey Belomutskiy, (c) 2012-2017 # -FAN_CONTROL_LOGIC=(fan and (coolant > fan_off_setting)) | (coolant > fan_on_setting) | is_clt_broken +FAN_CONTROL_LOGIC=(fan and (coolant > cfg_fanOffTemperature)) | (coolant > cfg_fanOnTemperature) | is_clt_broken -FUEL_PUMP_LOGIC=(time_since_boot < startup_fuel_pump_duration) | (rpm > 0) +FUEL_PUMP_LOGIC=(time_since_boot >= 0 & time_since_boot < startup_fuel_pump_duration) | (rpm > 0) ALTERNATOR_LOGIC=vbatt < 14.5 @@ -23,7 +23,8 @@ AC_RELAY_LOGIC=ac_on_switch & rpm > 850 COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4))) #needed by EFI_MAIN_RELAY_CONTROL -MAIN_RELAY_LOGIC=(time_since_boot < 2) | (vbatt > 5) | in_shutdown +#MAIN_RELAY_LOGIC=(time_since_boot >= 0 & time_since_boot < 2) | (vbatt > 5) | in_shutdown +MAIN_RELAY_LOGIC=(vbatt > 5) | in_shutdown # could be used for simple variable intake geometry setups or warning light or starter block RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1) From 24d91947a6e5760cbfc4df57eb67ab90fac99128 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 11 Sep 2020 03:54:07 -0400 Subject: [PATCH 4/4] Hellen says merge #1772 fast ADC --- firmware/config/boards/common_make.bat | 2 +- firmware/config/boards/kinetis/efifeatures.h | 2 +- firmware/config/boards/skeleton/efifeatures.h | 4 ++-- firmware/config/stm32f4ems/efifeatures.h | 4 ++-- firmware/config/stm32f4ems/mcuconf.h | 2 +- firmware/config/stm32f7ems/mcuconf.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/firmware/config/boards/common_make.bat b/firmware/config/boards/common_make.bat index 3af123cbb1..c11b679a4b 100644 --- a/firmware/config/boards/common_make.bat +++ b/firmware/config/boards/common_make.bat @@ -3,7 +3,7 @@ echo Entering %script_name% mkdir .dep rem todo: start using env variable for number of threads or for '-r' -make -j4 -r +make -r -j4 2> err.log if not exist build/rusefi.hex echo FAILED to compile by %script_name% with %PROJECT_BOARD% %DEBUG_LEVEL_OPT% and %EXTRA_PARAMS% if not exist build/rusefi.hex exit -1 diff --git a/firmware/config/boards/kinetis/efifeatures.h b/firmware/config/boards/kinetis/efifeatures.h index 864f846cb2..020729a632 100644 --- a/firmware/config/boards/kinetis/efifeatures.h +++ b/firmware/config/boards/kinetis/efifeatures.h @@ -265,7 +265,7 @@ // todo: switch to continues ADC conversion for slow ADC? // https://github.com/rusefi/rusefi/issues/630 // todo: switch to continues ADC conversion for fast ADC? -#define EFI_INTERNAL_FAST_ADC_PWM &PWMD2 +#define EFI_INTERNAL_FAST_ADC_GPT &GPTD2 // todo: why 64 SPLL prescaler doesn't work? // 168000000/64/128/1025 = ~20Hz diff --git a/firmware/config/boards/skeleton/efifeatures.h b/firmware/config/boards/skeleton/efifeatures.h index 0dadd13dbd..b12af0c59d 100644 --- a/firmware/config/boards/skeleton/efifeatures.h +++ b/firmware/config/boards/skeleton/efifeatures.h @@ -272,7 +272,7 @@ // todo: switch to continuous ADC conversion for slow ADC? // https://github.com/rusefi/rusefi/issues/630 // todo: switch to continues ADC conversion for fast ADC? -#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4 +#define EFI_INTERNAL_FAST_ADC_GPT &GPTD6 #define EFI_SPI1_AF 5 @@ -383,7 +383,7 @@ #undef TS_SERIAL_DEVICE #undef TS_UART_MODE #define EFI_CONSOLE_SERIAL_DEVICE (&SD1) -//#define EFI_CONSOLE_USB_DEVICE (&SDU1) +//#define EFI_CONSOLE_USB_DEVICE SDU1 #define EFI_UART_ECHO_TEST_MODE TRUE #define TS_UART_DEVICE (&UARTD3) #define TS_SERIAL_DEVICE (&SD3) diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 32713327c5..0bc051e6a9 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -250,7 +250,7 @@ #define EFI_USB_SERIAL TRUE #endif -#define EFI_CONSOLE_USB_DEVICE (&SDU1) +#define EFI_CONSOLE_USB_DEVICE SDU1 /** * While we embed multiple PnP configurations into the same firmware binary, these marcoses give us control @@ -304,7 +304,7 @@ // todo: switch to continues ADC conversion for slow ADC? // https://github.com/rusefi/rusefi/issues/630 // todo: switch to continues ADC conversion for fast ADC? -#define EFI_INTERNAL_FAST_ADC_PWM &PWMD4 +#define EFI_INTERNAL_FAST_ADC_GPT &GPTD6 #define EFI_SPI1_AF 5 diff --git a/firmware/config/stm32f4ems/mcuconf.h b/firmware/config/stm32f4ems/mcuconf.h index bc971dc229..1e710689b9 100644 --- a/firmware/config/stm32f4ems/mcuconf.h +++ b/firmware/config/stm32f4ems/mcuconf.h @@ -180,7 +180,7 @@ #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 FALSE #define STM32_GPT_USE_TIM5 TRUE -#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM9 FALSE diff --git a/firmware/config/stm32f7ems/mcuconf.h b/firmware/config/stm32f7ems/mcuconf.h index 6fcb25519f..3cc3296ce3 100644 --- a/firmware/config/stm32f7ems/mcuconf.h +++ b/firmware/config/stm32f7ems/mcuconf.h @@ -201,7 +201,7 @@ #define STM32_GPT_USE_TIM3 FALSE #define STM32_GPT_USE_TIM4 FALSE #define STM32_GPT_USE_TIM5 TRUE -#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM7 FALSE #define STM32_GPT_USE_TIM8 FALSE #define STM32_GPT_USE_TIM9 FALSE