From 5385a040fd42fdaf2fe47428c938d71d6bf0eeca Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 3 Feb 2018 20:43:31 -0500 Subject: [PATCH] refactoring --- firmware/controllers/algo/engine.h | 1 - firmware/controllers/algo/engine_configuration.cpp | 13 ++++--------- firmware/controllers/trigger/trigger_central.cpp | 6 +++++- firmware/controllers/trigger/trigger_decoder.cpp | 1 - firmware/rusefi.cpp | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 6f2c9a2d35..ccfbccd21a 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -504,7 +504,6 @@ private: void prepareShapes(DECLARE_ENGINE_PARAMETER_SIGNATURE); void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX); -void refreshTriggerShape(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX); void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX); void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 5ded3a6a0c..584f190f9b 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -1279,14 +1279,6 @@ void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } -void refreshTriggerShape(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { - assertEngineReference(); - -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) - engine->triggerCentral.triggerShape.initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); -#endif -} - void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { #if EFI_PROD_CODE || defined(__DOXYGEN__) efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "apply c"); @@ -1294,7 +1286,10 @@ void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S #endif assertEngineReference(); - refreshTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); + +#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) + engine->triggerCentral.triggerShape.initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); +#endif #if EFI_FSIO || defined(__DOXYGEN__) applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index ae995cd572..0127e072ba 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -573,7 +573,11 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig COMPARE_CONFIG_PARAMS(bc.nb2ratioTo) || COMPARE_CONFIG_PARAMS(nbVvtIndex); if (changed) { - refreshTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); + assertEngineReference(); + + #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) + engine->triggerCentral.triggerShape.initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX); + #endif } isTriggerConfigChanged = isTriggerConfigChanged || changed; } diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 115a1090d7..defec4920d 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -583,7 +583,6 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET if (engine->triggerCentral.triggerShape.getSize() == 0) { firmwareError(CUSTOM_ERR_TRIGGER_ZERO, "triggerShape size is zero"); - return; } engine->engineCycleEventCount = getLength(); } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 54506584a8..5f45b0cfab 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -276,5 +276,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20180202; + return 20180203; }