From 49841f1adb33c417f3135ac5ba331f82a91ef517 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 15 Apr 2019 21:02:42 -0400 Subject: [PATCH] The Big Refactoring of 2019: configuration version should not be a global variable #656 --- firmware/controllers/algo/engine.h | 3 ++- firmware/controllers/trigger/trigger_central.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 9038d00b8d..cdd93dc09c 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -17,6 +17,7 @@ #include "listener_array.h" #include "accel_enrichment.h" #include "trigger_central.h" +#include "local_version_holder.h" #if EFI_SIGNAL_EXECUTOR_ONE_TIMER // PROD real firmware uses this implementation @@ -348,7 +349,7 @@ public: * we have not adjusted for yet */ bool isTriggerConfigChanged = false; - + LocalVersionHolder triggerVersion; // a pointer with interface type would make this code nicer but would carry extra runtime // cost to resolve pointer, we use instances as a micro optimization diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 31ebfdc291..e578db3cad 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -68,7 +68,6 @@ static histogram_s triggerCallbackHistogram; #endif /* EFI_HISTOGRAMS */ static Logging *logger; -static LocalVersionHolder triggerVersion; void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) { print("registerCkpListener: %s\r\n", name); @@ -672,7 +671,7 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig * @returns true if configuration just changed, and if that change has affected trigger */ bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - bool result = triggerVersion.isOld(engine->getGlobalConfigurationVersion()) && engine->isTriggerConfigChanged; + bool result = engine->triggerVersion.isOld(engine->getGlobalConfigurationVersion()) && engine->isTriggerConfigChanged; engine->isTriggerConfigChanged = false; // whoever has called the method is supposed to react to changes return result; }