diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index c50edc9a78..0d583cf5e4 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -809,5 +809,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20190408; + return 20190409; } diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index dcfb753794..5b37e27bd1 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -260,11 +260,11 @@ void stopSpi(spi_device_e device) { } void applyNewHardwareSettings(void) { + // all 'stop' methods need to go before we begin starting pins + #if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) - applyNewTriggerInputPins(); + stopTriggerInputPins(); #endif /* EFI_SHAFT_POSITION_INPUT */ - - // all 'stop' methods need to go before we begin starting pins enginePins.stopInjectionPins(); enginePins.stopIgnitionPins(); @@ -293,8 +293,6 @@ void applyNewHardwareSettings(void) { if (engineConfiguration->bc.is_enabled_spi_3 != activeConfiguration.bc.is_enabled_spi_3) stopSpi(SPI_DEVICE_3); - - unregisterPin(engineConfiguration->bc.HD44780_rs, activeConfiguration.bc.HD44780_rs); unregisterPin(engineConfiguration->bc.HD44780_e, activeConfiguration.bc.HD44780_e); unregisterPin(engineConfiguration->bc.HD44780_db4, activeConfiguration.bc.HD44780_db4); @@ -306,6 +304,9 @@ void applyNewHardwareSettings(void) { enginePins.unregisterPins(); +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) + startTriggerInputPins(); +#endif /* EFI_SHAFT_POSITION_INPUT */ enginePins.startInjectionPins(); enginePins.startIgnitionPins(); diff --git a/firmware/hw_layer/trigger_input.h b/firmware/hw_layer/trigger_input.h index 22818b01c9..b48c1162ba 100644 --- a/firmware/hw_layer/trigger_input.h +++ b/firmware/hw_layer/trigger_input.h @@ -13,5 +13,7 @@ void turnOnTriggerInputPins(Logging *sharedLogger); void applyNewTriggerInputPins(void); +void startTriggerInputPins(void); +void stopTriggerInputPins(void); #endif /* CRANK_INPUT_H_ */ diff --git a/firmware/hw_layer/trigger_input_icu.cpp b/firmware/hw_layer/trigger_input_icu.cpp index 8e2d3a36f5..bf6469a272 100644 --- a/firmware/hw_layer/trigger_input_icu.cpp +++ b/firmware/hw_layer/trigger_input_icu.cpp @@ -173,11 +173,7 @@ void stopTriggerInputPins(void) { } } -void applyNewTriggerInputPins(void) { -// first we will turn off all the changed pins - stopTriggerInputPins(); - -// then we will enable all the changed pins +void startTriggerInputPins(void) { for (int i = 0; i < TRIGGER_SUPPORTED_CHANNELS; i++) { if (CONFIGB(triggerInputPins)[i] != activeConfiguration.bc.triggerInputPins[i]) { @@ -193,4 +189,11 @@ void applyNewTriggerInputPins(void) { rememberPrimaryChannel(); } +void applyNewTriggerInputPins(void) { +// first we will turn off all the changed pins + stopTriggerInputPins(); +// then we will enable all the changed pins + startTriggerInputPins(); +} + #endif /* EFI_SHAFT_POSITION_INPUT && HAL_USE_ICU */