The Big Refactoring of 2019: configuration version should not be a global variable #656
This commit is contained in:
parent
877ac257fe
commit
7c7889cb71
|
@ -17,6 +17,7 @@
|
||||||
#include "listener_array.h"
|
#include "listener_array.h"
|
||||||
#include "accel_enrichment.h"
|
#include "accel_enrichment.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
|
#include "local_version_holder.h"
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||||
// PROD real firmware uses this implementation
|
// PROD real firmware uses this implementation
|
||||||
|
@ -348,7 +349,7 @@ public:
|
||||||
* we have not adjusted for yet
|
* we have not adjusted for yet
|
||||||
*/
|
*/
|
||||||
bool isTriggerConfigChanged = false;
|
bool isTriggerConfigChanged = false;
|
||||||
|
LocalVersionHolder triggerVersion;
|
||||||
|
|
||||||
// a pointer with interface type would make this code nicer but would carry extra runtime
|
// 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
|
// cost to resolve pointer, we use instances as a micro optimization
|
||||||
|
|
|
@ -68,7 +68,6 @@ static histogram_s triggerCallbackHistogram;
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
static LocalVersionHolder triggerVersion;
|
|
||||||
|
|
||||||
void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
|
void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
|
||||||
print("registerCkpListener: %s\r\n", name);
|
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
|
* @returns true if configuration just changed, and if that change has affected trigger
|
||||||
*/
|
*/
|
||||||
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
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
|
engine->isTriggerConfigChanged = false; // whoever has called the method is supposed to react to changes
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue