mirror of https://github.com/rusefi/rusefi-1.git
The Big Refactoring of 2019: configuration version should not be a global variable #656
This commit is contained in:
parent
fd9506b4e1
commit
2f0804022b
|
@ -64,7 +64,7 @@ static msg_t auxPidThread(int param) {
|
||||||
while (true) {
|
while (true) {
|
||||||
auxPid.sleep();
|
auxPid.sleep();
|
||||||
|
|
||||||
if (parametersVersion.isOld()) {
|
if (parametersVersion.isOld(getGlobalConfigurationVersion())) {
|
||||||
pidReset();
|
pidReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ static void periodicSlowCallback(Engine *engine) {
|
||||||
updatePrimeInjectionPulseState(PASS_ENGINE_PARAMETER_SIGNATURE);
|
updatePrimeInjectionPulseState(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (versionForConfigurationListeners.isOld()) {
|
if (versionForConfigurationListeners.isOld(getGlobalConfigurationVersion())) {
|
||||||
updateAccelParameters();
|
updateAccelParameters();
|
||||||
engine->engineState.warmupAfrPid.reset();
|
engine->engineState.warmupAfrPid.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
||||||
|
|
||||||
if (trgEventIndex == 0) {
|
if (trgEventIndex == 0) {
|
||||||
|
|
||||||
if (checkIfTriggerConfigChanged()) {
|
if (checkIfTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||||
engine->ignitionEvents.isReady = false; // we need to rebuild ignition schedule
|
engine->ignitionEvents.isReady = false; // we need to rebuild ignition schedule
|
||||||
engine->injectionEvents.isReady = false;
|
engine->injectionEvents.isReady = false;
|
||||||
// moved 'triggerIndexByAngle' into trigger initialization (why was it invoked from here if it's only about trigger shape & optimization?)
|
// moved 'triggerIndexByAngle' into trigger initialization (why was it invoked from here if it's only about trigger shape & optimization?)
|
||||||
|
|
|
@ -691,8 +691,8 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig
|
||||||
/**
|
/**
|
||||||
* @returns true if configuration just changed, and if that change has affected trigger
|
* @returns true if configuration just changed, and if that change has affected trigger
|
||||||
*/
|
*/
|
||||||
bool checkIfTriggerConfigChanged(void) {
|
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
bool result = triggerVersion.isOld() && isTriggerConfigChanged;
|
bool result = triggerVersion.isOld(getGlobalConfigurationVersion()) && isTriggerConfigChanged;
|
||||||
isTriggerConfigChanged = false; // whoever has called the method is supposed to react to changes
|
isTriggerConfigChanged = false; // whoever has called the method is supposed to react to changes
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ int isSignalDecoderError(void);
|
||||||
void resetMaxValues();
|
void resetMaxValues();
|
||||||
|
|
||||||
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
bool checkIfTriggerConfigChanged(void);
|
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
bool readIfTriggerConfigChangedForUnitTest(void);
|
bool readIfTriggerConfigChangedForUnitTest(void);
|
||||||
void resetTriggerConfigChangedForUnitTest(void);
|
void resetTriggerConfigChangedForUnitTest(void);
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
|
|
||||||
#include "LocalVersionHolder.h"
|
#include "LocalVersionHolder.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* we rely on external source of global version
|
|
||||||
*/
|
|
||||||
int getGlobalConfigurationVersion(void);
|
|
||||||
|
|
||||||
LocalVersionHolder::LocalVersionHolder() {
|
LocalVersionHolder::LocalVersionHolder() {
|
||||||
/**
|
/**
|
||||||
* we want local version to be 'old' on instantiation
|
* we want local version to be 'old' on instantiation
|
||||||
|
@ -23,8 +18,7 @@ int LocalVersionHolder::getVersion() {
|
||||||
return localVersion;
|
return localVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalVersionHolder::isOld() {
|
bool LocalVersionHolder::isOld(int global) {
|
||||||
int global = getGlobalConfigurationVersion();
|
|
||||||
if (global > localVersion) {
|
if (global > localVersion) {
|
||||||
localVersion = global;
|
localVersion = global;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return true if getGlobalConfigurationVersion() has changed since last time we've invoked this method
|
* @return true if getGlobalConfigurationVersion() has changed since last time we've invoked this method
|
||||||
*/
|
*/
|
||||||
bool isOld();
|
bool isOld(int currentVersion);
|
||||||
int getVersion();
|
int getVersion();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue