The Big Refactoring of 2019: configuration version should not be a global variable #656

This commit is contained in:
rusefi 2019-04-15 21:02:42 -04:00
parent 8a45420475
commit 49841f1adb
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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;
}