From 98a75d19e7ee8146ab1dd1ec0035c86fd2879c09 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 15 Apr 2019 20:27:19 -0400 Subject: [PATCH] The Big Refactoring of 2019: configuration version should not be a global variable fix #656 --- firmware/controllers/algo/engine.h | 6 ++++++ firmware/controllers/algo/engine_configuration.cpp | 9 +-------- firmware/controllers/algo/engine_configuration.h | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 9038d00b8d..6663a54b5a 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -422,6 +422,12 @@ public: */ efitick_t stopEngineRequestTimeNt = 0; + /** + * This counter is incremented every time user adjusts ECU parameters online (either via dev console or other + * tuning software) + */ + volatile int globalConfigurationVersion = 0; + /** * always 360 or 720, never zero */ diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 205dd7b89c..8fb4e8a046 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -138,12 +138,6 @@ static fuel_table_t alphaNfuel = { {/*15 engineLoad=100.00*/ /*0 800.0*/xxxxx, /*1 1213.0*/xxxxx, /*2 1626.0*/xxxxx, /*3 2040.0*/xxxxx, /*4 2453.0*/xxxxx, /*5 2866.0*/xxxxx, /*6 3280.0*/xxxxx, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx} }; -/** - * This counter is incremented every time user adjusts ECU parameters online (either via dev console or other - * tuning software) - */ -volatile int globalConfigurationVersion = 0; - /** * Current engine configuration. On firmware start we assign empty configuration, then * we copy actual configuration after reading settings. @@ -165,7 +159,6 @@ void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ } - extern LoggingWithStorage sharedLogger; /** @@ -173,7 +166,7 @@ extern LoggingWithStorage sharedLogger; * online tuning of most values in the maps does not count as configuration change, but 'Burn' command does */ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - globalConfigurationVersion++; + ENGINE(globalConfigurationVersion++); #if EFI_DEFAILED_LOGGING scheduleMsg(&sharedLogger, "set globalConfigurationVersion=%d", globalConfigurationVersion); #endif /* EFI_DEFAILED_LOGGING */ diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index e589e937b3..e2b057e463 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -73,7 +73,6 @@ void setDefaultSdCardParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE); void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE); -int getGlobalConfigurationVersion(void); void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration); void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration);