From 4744515cf5b207caf8b799bf21ac8959ae0b9fea Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 26 Apr 2024 18:49:24 -0400 Subject: [PATCH] Usability: critical error in case of unneeded second channel fix #6419 --- firmware/CHANGELOG.md | 1 + .../boards/f407-discovery/board_configuration.cpp | 2 +- .../trigger/decoders/trigger_structure.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/firmware/CHANGELOG.md b/firmware/CHANGELOG.md index 6ae42d7839..274b6855de 100644 --- a/firmware/CHANGELOG.md +++ b/firmware/CHANGELOG.md @@ -30,6 +30,7 @@ Release template (copy/paste this for new release): - "60/2 VW" trigger wheel renamed to "60-2 Wrong Polarity" #988 - exhaust VVTs now use it's onw Edge Select setting - removing weird 1+16 trigger wheel #6418 + - critical error in case of unneeded second channel #6419 ## Unreleased diff --git a/firmware/config/boards/f407-discovery/board_configuration.cpp b/firmware/config/boards/f407-discovery/board_configuration.cpp index 47fcca6669..b4fa933d4d 100644 --- a/firmware/config/boards/f407-discovery/board_configuration.cpp +++ b/firmware/config/boards/f407-discovery/board_configuration.cpp @@ -111,7 +111,7 @@ void setBoardDefaultConfiguration() { engineConfiguration->triggerSimulatorPins[1] = Gpio::D2; engineConfiguration->triggerInputPins[0] = Gpio::C6; - engineConfiguration->triggerInputPins[1] = Gpio::A5; +// engineConfiguration->triggerInputPins[1] = Gpio::A5; // set this to SPI_DEVICE_3 to enable stimulation //engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3; diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index faac9ee440..879e616074 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -771,6 +771,17 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio warning(ObdCode::CUSTOM_ERR_NO_SHAPE, "initializeTriggerWaveform() not implemented: %d", triggerType.type); } + if (!needSecondTriggerInput && +#if EFI_UNIT_TEST + engineConfiguration != nullptr && +#endif + engineConfiguration->triggerInputPins[1] != Gpio::Unassigned) { +// todo: technical debt: HW CI should not require special treatment +#ifndef HARDWARE_CI + criticalError("Single-channel trigger %s selected while two inputs were configured", getTrigger_type_e(triggerType.type)); +#endif + } + /** * Feb 2019 suggestion: it would be an improvement to remove 'expectedEventCount' logic from 'addEvent' * and move it here, after all events were added.