From 523bef2eb6a3fa72282d13684e8cdc284869ccd6 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Tue, 30 Mar 2021 04:28:22 -0700 Subject: [PATCH] fix (#2511) --- firmware/controllers/algo/engine_configuration.cpp | 9 ++++++--- firmware/controllers/algo/engine_configuration.h | 2 ++ firmware/rusefi.cpp | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 74868006ad..eeaf33c58e 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -152,7 +152,7 @@ engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage; extern engine_configuration_s *engineConfiguration; -static void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { +void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s)); #else @@ -1144,6 +1144,11 @@ void loadConfiguration(Logging* logger DECLARE_ENGINE_PARAMETER_SUFFIX) { palSetPadMode(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN, PAL_MODE_INPUT_PULLUP); #endif /* CONFIG_RESET_SWITCH_PORT */ +#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH + // Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly + prepareVoidConfiguration(&activeConfiguration); +#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ + #if EFI_INTERNAL_FLASH if (SHOULD_IGNORE_FLASH() || IGNORE_FLASH_CONFIGURATION) { engineConfiguration->engineType = DEFAULT_ENGINE_TYPE; @@ -1159,8 +1164,6 @@ void loadConfiguration(Logging* logger DECLARE_ENGINE_PARAMETER_SUFFIX) { engineConfiguration->engineType = DEFAULT_ENGINE_TYPE; resetConfigurationExt(logger, engineConfiguration->engineType PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_INTERNAL_FLASH */ - - rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); } void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) { diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 23d993d997..8ae8ed82d7 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -61,6 +61,8 @@ typedef void (*configuration_callback_t)(engine_configuration_s*); void loadConfiguration(Logging* logger DECLARE_ENGINE_PARAMETER_SUFFIX); void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX); void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX); + +void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); #endif /* __cplusplus */ struct ConfigOverrides { diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 15060945c6..539114eabd 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -237,6 +237,9 @@ void runRusEfi(void) { */ initEngineContoller(&sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE); + // This has to happen after RegisteredOutputPins are init'd: otherwise no change will be detected, and no init will happen + rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); + #if EFI_PERF_METRICS initTimePerfActions(&sharedLogger); #endif