From 001fbb25265398370bc0624660c27689b38d2795 Mon Sep 17 00:00:00 2001 From: andreika-git Date: Fri, 29 Mar 2019 16:46:16 +0200 Subject: [PATCH] More portability & bootloader fix (#720) * fix bootloader * EFI_FSIO * EFI_EMULATE_POSITION_SENSORS, EFI_BOARD_TEST, EFI_AUX_PID, EFI_JOYSTICK --- firmware/bootloader/src/Makefile | 2 +- firmware/config/engines/ford_festiva.cpp | 4 ++-- firmware/config/engines/lada_kalina.cpp | 3 ++- firmware/config/engines/mazda_miata_1_6.cpp | 2 ++ firmware/config/engines/mitsubishi.cpp | 2 +- firmware/controllers/algo/engine_configuration.cpp | 6 ++++-- firmware/controllers/settings.cpp | 4 ++-- firmware/hw_layer/board_test.cpp | 2 +- firmware/hw_layer/hardware.cpp | 10 ++++++++-- firmware/util/cli_registry.cpp | 4 ++-- 10 files changed, 25 insertions(+), 14 deletions(-) diff --git a/firmware/bootloader/src/Makefile b/firmware/bootloader/src/Makefile index 34478ae574..64669ff2dc 100644 --- a/firmware/bootloader/src/Makefile +++ b/firmware/bootloader/src/Makefile @@ -127,7 +127,7 @@ include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk include $(CONFIG)/boards/$(PROJECT_BOARD)/board.mk -include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_stm32.mk +include $(PROJECT_DIR)/hw_layer/$(CPU_HWLAYER)/hw_ports.mk # Define linker script file here ifeq ($(LDSCRIPT),) diff --git a/firmware/config/engines/ford_festiva.cpp b/firmware/config/engines/ford_festiva.cpp index 424438c664..e04f7ec88c 100644 --- a/firmware/config/engines/ford_festiva.cpp +++ b/firmware/config/engines/ford_festiva.cpp @@ -229,6 +229,7 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2; // VICS solenoid +#if EFI_FSIO || defined(__DOXYGEN__) /** * to test * set_fsio_setting 1 5000 @@ -237,7 +238,6 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // set_fsio_expression 1 "rpm > fsio_setting(1)" setFsioExt(0, GPIOE_3, RPM_ABOVE_USER_SETTING_1, 150 PASS_ENGINE_PARAMETER_SUFFIX); - // warning light /** * to test @@ -255,7 +255,7 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // setFsio(1, GPIOC_13, "rpm 2 fsio_setting > coolant 3 fsio_setting > | vbatt 4 fsio_setting < |" PASS_ENGINE_PARAMETER_SUFFIX); setFsio(1, GPIOD_7, RPM_ABOVE_USER_SETTING_2 PASS_ENGINE_PARAMETER_SUFFIX); - +#endif /* EFI_FSIO */ config->ignitionRpmBins[0] = 800; config->ignitionRpmBins[1] = 1200; diff --git a/firmware/config/engines/lada_kalina.cpp b/firmware/config/engines/lada_kalina.cpp index 30a7fd8a14..40162a384f 100644 --- a/firmware/config/engines/lada_kalina.cpp +++ b/firmware/config/engines/lada_kalina.cpp @@ -50,6 +50,7 @@ void setLadaKalina(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // starter relay solenoid +#if EFI_FSIO || defined(__DOXYGEN__) /** * to test * set_fsio_setting 1 5000 @@ -57,5 +58,5 @@ void setLadaKalina(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->bc.fsio_setting[0] = 500; // set_rpn_expression 1 "rpm 0 fsio_setting <" setFsioExt(0, GPIOE_3, RPM_BELOW_USER_SETTING_1, 0 PASS_ENGINE_PARAMETER_SUFFIX); - +#endif /* EFI_FSIO */ } diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 1396737952..5837b21dd9 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -231,8 +231,10 @@ void setMiataNA6_MAP_Configuration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // set_fsio_expression 0 "((rpm > fsio_setting(4) & (fsio_analog_input < fsio_setting(5)) | rpm > fsio_setting(1) | (coolant > fsio_setting(2) > | (vbatt < fsio_setting(3)" +#if EFI_FSIO || defined(__DOXYGEN__) // todo: convert setFsio(0, GPIOC_13, COMBINED_WARNING_LIGHT PASS_ENGINE_PARAMETER_SUFFIX); +#endif /* EFI_FSIO */ boardConfiguration->injectionPins[0] = GPIOD_3; // #1&3 pin 3U boardConfiguration->injectionPins[1] = GPIOE_2; // #2&4 pin 3V diff --git a/firmware/config/engines/mitsubishi.cpp b/firmware/config/engines/mitsubishi.cpp index 6b0995abe5..5fbdc3fe23 100644 --- a/firmware/config/engines/mitsubishi.cpp +++ b/firmware/config/engines/mitsubishi.cpp @@ -90,7 +90,7 @@ void setMitsubishiConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_FSIO || defined(__DOXYGEN__) setFsioExt(0, GPIOC_9, RPM_ABOVE_6000_SOLENOID_80_DUTY, 200 PASS_ENGINE_PARAMETER_SUFFIX); setFsioExt(1, GPIOC_7, RPM_ABOVE_2000_SOLENOID_50_DUTY, 200 PASS_ENGINE_PARAMETER_SUFFIX); -#endif +#endif /* EFI_FSIO */ } diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 4066a87f10..6087581a96 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -194,8 +194,9 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) { onConfigurationChangeRpmEmulatorCallback(&activeConfiguration); #endif /* EFI_EMULATE_POSITION_SENSORS */ +#if EFI_FSIO || defined(__DOXYGEN__) onConfigurationChangeFsioCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX); - +#endif /* EFI_FSIO */ rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); } @@ -1108,6 +1109,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { setBoardConfigurationOverrides(); #endif +#if EFI_FSIO || defined(__DOXYGEN__) /** * to test: * set_fsio_setting 1 5000 @@ -1121,7 +1123,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // simple warning light as default configuration // set_fsio_expression 1 "rpm > fsio_setting(1)" setFsio(0, GPIO_UNASSIGNED, RPM_ABOVE_USER_SETTING_1 PASS_ENGINE_PARAMETER_SUFFIX); - +#endif /* EFI_FSIO */ } void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) { diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index b20e89bf2e..e5426b8f6d 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -1309,10 +1309,10 @@ static void setValue(const char *paramStr, const char *valueStr) { engineConfiguration->tpsMax = valueI; } else if (strEqualCaseInsensitive(paramStr, "tps_min")) { engineConfiguration->tpsMin = valueI; -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) } else if (strEqualCaseInsensitive(paramStr, "rpm")) { setTriggerEmulatorRPM(valueI); -#endif /* ! EFI_UNIT_TEST */ +#endif /* EFI_EMULATE_POSITION_SENSORS */ } else if (strEqualCaseInsensitive(paramStr, "vvt_offset")) { engineConfiguration->vvtOffset = valueF; } else if (strEqualCaseInsensitive(paramStr, "vvt_mode")) { diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp index ec2adde098..7e4042a417 100644 --- a/firmware/hw_layer/board_test.cpp +++ b/firmware/hw_layer/board_test.cpp @@ -23,7 +23,7 @@ #include "global.h" -#if EFI_BOARD_TEST +#if EFI_BOARD_TEST || defined(__DOXYGEN__) #include "engine.h" #include "board_test.h" #include "pin_repository.h" diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 84044a1e4c..354524cbcd 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -278,7 +278,9 @@ void applyNewHardwareSettings(void) { #if EFI_VEHICLE_SPEED || defined(__DOXYGEN__) stopVSSPins(); #endif /* EFI_VEHICLE_SPEED */ +#if EFI_AUX_PID || defined(__DOXYGEN__) stopAuxPins(); +#endif /* EFI_AUX_PID */ if (engineConfiguration->bc.is_enabled_spi_1 != activeConfiguration.bc.is_enabled_spi_1) stopSpi(SPI_DEVICE_1); @@ -316,7 +318,9 @@ void applyNewHardwareSettings(void) { #if EFI_VEHICLE_SPEED || defined(__DOXYGEN__) startVSSPins(); #endif /* EFI_VEHICLE_SPEED */ +#if EFI_AUX_PID || defined(__DOXYGEN__) startAuxPins(); +#endif /* EFI_AUX_PID */ adcConfigListener(engine); } @@ -419,10 +423,12 @@ void initHardware(Logging *l) { initAdcInputs(isBoardTestMode_b); #endif +#if EFI_BOARD_TEST || defined(__DOXYGEN__) if (isBoardTestMode_b) { // this method never returns initBoardTest(); } +#endif /* EFI_BOARD_TEST */ initRtc(); @@ -513,9 +519,9 @@ void initHardware(Logging *l) { cdmIonInit(); #endif -#if (HAL_USE_PAL && EFI_PROD_CODE) || defined(__DOXYGEN__) +#if (HAL_USE_PAL && EFI_JOYSTICK) || defined(__DOXYGEN__) initJoystick(sharedLogger); -#endif /* HAL_USE_PAL && EFI_PROD_CODE */ +#endif /* HAL_USE_PAL && EFI_JOYSTICK */ calcFastAdcIndexes(); diff --git a/firmware/util/cli_registry.cpp b/firmware/util/cli_registry.cpp index 3702e9efcb..b2a2de9df8 100644 --- a/firmware/util/cli_registry.cpp +++ b/firmware/util/cli_registry.cpp @@ -168,12 +168,12 @@ static int getParameterCount(action_type_e parameterType) { * @brief This function prints out a list of all available commands */ void helpCommand(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_BOARD_TEST || defined(__DOXYGEN__) if (isBoardTestMode()) { printBoardTestState(); return; } -#endif /* EFI_PROD_CODE */ +#endif /* EFI_BOARD_TEST */ #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) scheduleMsg(logging, "%d actions available", consoleActionCount);