From e721c1768f26b5920b8196f1cb0a14fdc5e3b2cc Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 14 Jul 2021 22:51:08 -0400 Subject: [PATCH] trigger signal debug pins - logic level output #2959 --- .../digital_input/trigger/trigger_input.cpp | 12 ++++++------ .../hw_layer/digital_input/trigger/trigger_input.h | 8 ++++---- firmware/hw_layer/hardware.cpp | 10 +++++----- unit_tests/tests/test_change_engine_type.cpp | 14 ++++++++++++++ unit_tests/tests/tests.mk | 1 + 5 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 unit_tests/tests/test_change_engine_type.cpp diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input.cpp index 45a39c3c08..742ae24491 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input.cpp +++ b/firmware/hw_layer/digital_input/trigger/trigger_input.cpp @@ -133,7 +133,7 @@ static void turnOffTriggerInputPin(int index, bool isTriggerShaft) { /* Exported functions. */ /*==========================================================================*/ -void stopTriggerInputPins(void) { +void stopTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) { if (isConfigurationChanged(triggerInputPins[i])) { turnOffTriggerInputPin(i, true); @@ -152,7 +152,7 @@ void stopTriggerInputPins(void) { } } -void startTriggerInputPins(void) { +void startTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) { if (isConfigurationChanged(triggerInputPins[i])) { const char * msg = (i == 0 ? "Trigger #1" : (i == 1 ? "Trigger #2" : "Trigger #3")); @@ -173,7 +173,7 @@ void startTriggerInputPins(void) { } } -void turnOnTriggerInputPins() { +void turnOnTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { /* init all trigger HW available */ icuTriggerTurnOnInputPins(); extiTriggerTurnOnInputPins(); @@ -183,11 +183,11 @@ void turnOnTriggerInputPins() { #endif /* (HAL_USE_ICU == TRUE) || (HAL_TRIGGER_USE_PAL == TRUE) */ -void applyNewTriggerInputPins(void) { +void applyNewTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // first we will turn off all the changed pins - stopTriggerInputPins(); + stopTriggerInputPins(PASS_ENGINE_PARAMETER_SIGNATURE); // then we will enable all the changed pins - startTriggerInputPins(); + startTriggerInputPins(PASS_ENGINE_PARAMETER_SIGNATURE); } #endif /* EFI_SHAFT_POSITION_INPUT */ diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input.h b/firmware/hw_layer/digital_input/trigger/trigger_input.h index 2939fa5072..f05d5a9622 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input.h +++ b/firmware/hw_layer/digital_input/trigger/trigger_input.h @@ -28,10 +28,10 @@ #define TRIGGER_SUPPORTED_CHANNELS 2 -void turnOnTriggerInputPins(); -void applyNewTriggerInputPins(void); -void startTriggerInputPins(void); -void stopTriggerInputPins(void); +void turnOnTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE); +void applyNewTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE); +void startTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE); +void stopTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE); #if HAL_TRIGGER_USE_ADC && HAL_USE_ADC // This detector has 2 modes for low-RPM (ADC) and fast-RPM (EXTI) diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index cb0aaa5793..8e03b7880d 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -269,7 +269,7 @@ static void adcConfigListener(Engine *engine) { calcFastAdcIndexes(); } -static void turnOnHardware() { +static void turnOnHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_FASTER_UNIFORM_ADC for (int i = 0; i < ADC_MAX_CHANNELS_COUNT; i++) { averagedSamples[i] = 0; @@ -278,7 +278,7 @@ static void turnOnHardware() { #endif /* EFI_FASTER_UNIFORM_ADC */ #if EFI_SHAFT_POSITION_INPUT - turnOnTriggerInputPins(); + turnOnTriggerInputPins(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_SHAFT_POSITION_INPUT */ } @@ -311,7 +311,7 @@ void applyNewHardwareSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) { ButtonDebounce::stopConfigurationList(); #if EFI_SHAFT_POSITION_INPUT - stopTriggerInputPins(); + stopTriggerInputPins(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_SHAFT_POSITION_INPUT */ @@ -384,7 +384,7 @@ void applyNewHardwareSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) { ******************************************/ #if EFI_SHAFT_POSITION_INPUT - startTriggerInputPins(); + startTriggerInputPins(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_SHAFT_POSITION_INPUT */ #if (HAL_USE_PAL && EFI_JOYSTICK) @@ -562,7 +562,7 @@ void initHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // init_adc_mcp3208(&adcState, &SPID2); // requestAdcValue(&adcState, 0); - turnOnHardware(); + turnOnHardware(PASS_ENGINE_PARAMETER_SIGNATURE); #if EFI_HIP_9011 initHip9011(); diff --git a/unit_tests/tests/test_change_engine_type.cpp b/unit_tests/tests/test_change_engine_type.cpp new file mode 100644 index 0000000000..34a3c6cd4f --- /dev/null +++ b/unit_tests/tests/test_change_engine_type.cpp @@ -0,0 +1,14 @@ +/* + * @file test_change_engine_type.cpp + * + * @date Jul 14, 2021 + * @author Andrey Belomutskiy, (c) 2012-2021 + */ + +#include "engine_test_helper.h" + +TEST(misc, changeEngineType) { + WITH_ENGINE_TEST_HELPER (FORD_ASPIRE_1996); + +} + diff --git a/unit_tests/tests/tests.mk b/unit_tests/tests/tests.mk index 00099ca704..7de0d3ab37 100644 --- a/unit_tests/tests/tests.mk +++ b/unit_tests/tests/tests.mk @@ -25,6 +25,7 @@ TESTS_SRC_CPP = \ tests/lua/test_lua_basic.cpp \ tests/lua/test_lua_hooks.cpp \ tests/sensor/test_cj125.cpp \ + tests/test_change_engine_type.cpp \ tests/util/test_timer.cpp \ tests/system/test_periodic_thread_controller.cpp \ tests/test_util.cpp \