parent
8fee275f53
commit
4fa48c0ca7
|
@ -343,6 +343,12 @@ public:
|
||||||
IgnitionEventList ignitionEvents;
|
IgnitionEventList ignitionEvents;
|
||||||
|
|
||||||
int getGlobalConfigurationVersion(void) const;
|
int getGlobalConfigurationVersion(void) const;
|
||||||
|
/**
|
||||||
|
* true if a recent configuration change has changed any of the trigger settings which
|
||||||
|
* we have not adjusted for yet
|
||||||
|
*/
|
||||||
|
bool isTriggerConfigChanged = false;
|
||||||
|
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -63,12 +63,6 @@ WaveChart waveChart;
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
/**
|
|
||||||
* true if a recent configuration change has changed any of the trigger settings which
|
|
||||||
* we have not adjusted for yet
|
|
||||||
*/
|
|
||||||
static bool isTriggerConfigChanged = false;
|
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
||||||
static histogram_s triggerCallbackHistogram;
|
static histogram_s triggerCallbackHistogram;
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
@ -678,28 +672,24 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
scheduleMsg(logger, "isTriggerConfigChanged=%d", isTriggerConfigChanged);
|
scheduleMsg(logger, "isTriggerConfigChanged=%d", engine->isTriggerConfigChanged);
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
// we do not want to miss two updates in a row
|
// we do not want to miss two updates in a row
|
||||||
isTriggerConfigChanged = isTriggerConfigChanged || changed;
|
engine->isTriggerConfigChanged = engine->isTriggerConfigChanged || changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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()) && isTriggerConfigChanged;
|
bool result = triggerVersion.isOld(engine->getGlobalConfigurationVersion()) && engine->isTriggerConfigChanged;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readIfTriggerConfigChangedForUnitTest(void) {
|
bool readIfTriggerConfigChangedForUnitTest(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return isTriggerConfigChanged;
|
return engine->isTriggerConfigChanged;
|
||||||
}
|
|
||||||
|
|
||||||
void resetTriggerConfigChangedForUnitTest(void) {
|
|
||||||
isTriggerConfigChanged = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTriggerCentral(Logging *sharedLogger) {
|
void initTriggerCentral(Logging *sharedLogger) {
|
||||||
|
|
|
@ -68,7 +68,6 @@ void resetMaxValues();
|
||||||
|
|
||||||
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
bool readIfTriggerConfigChangedForUnitTest(void);
|
bool readIfTriggerConfigChangedForUnitTest(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void resetTriggerConfigChangedForUnitTest(void);
|
|
||||||
|
|
||||||
#endif /* TRIGGER_CENTRAL_H_ */
|
#endif /* TRIGGER_CENTRAL_H_ */
|
||||||
|
|
|
@ -75,7 +75,6 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
|
||||||
engine->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
engine->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||||
engine->triggerCentral.addEventListener(mainTriggerCallback, "main loop", engine);
|
engine->triggerCentral.addEventListener(mainTriggerCallback, "main loop", engine);
|
||||||
resetTriggerConfigChangedForUnitTest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,11 +212,11 @@ void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e inject
|
||||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
||||||
ASSERT_EQ( 0, readIfTriggerConfigChangedForUnitTest()) << "trigger #1";
|
ASSERT_EQ( 0, readIfTriggerConfigChangedForUnitTest(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #1";
|
||||||
|
|
||||||
engineConfiguration->trigger.type = trigger;
|
engineConfiguration->trigger.type = trigger;
|
||||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
ASSERT_EQ( 1, readIfTriggerConfigChangedForUnitTest()) << "trigger #2";
|
ASSERT_EQ( 1, readIfTriggerConfigChangedForUnitTest(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #2";
|
||||||
|
|
||||||
eth->applyTriggerShape();
|
eth->applyTriggerShape();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue