better state validation

This commit is contained in:
rusefi 2018-03-04 21:02:35 -05:00
parent f7f54483c1
commit 115bc084bf
3 changed files with 7 additions and 0 deletions

View File

@ -598,6 +598,10 @@ bool checkIfTriggerConfigChanged(void) {
return result; return result;
} }
bool readIfTriggerConfigChangedForUnitTest(void) {
return isTriggerConfigChanged;
}
void initTriggerCentral(Logging *sharedLogger) { void initTriggerCentral(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
strcpy((char*) shaft_signal_msg_index, "x_"); strcpy((char*) shaft_signal_msg_index, "x_");

View File

@ -65,5 +65,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(void); bool checkIfTriggerConfigChanged(void);
bool readIfTriggerConfigChangedForUnitTest(void);
#endif /* TRIGGER_CENTRAL_H_ */ #endif /* TRIGGER_CENTRAL_H_ */

View File

@ -632,9 +632,11 @@ void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth) {
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("CLT", 70, engine->sensors.clt); assertEqualsM("CLT", 70, engine->sensors.clt);
assertEqualsM("trigger #1", 0, readIfTriggerConfigChangedForUnitTest());
engineConfiguration->trigger.type = TT_ONE; engineConfiguration->trigger.type = TT_ONE;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("trigger #2", 1, readIfTriggerConfigChangedForUnitTest());
eth->applyTriggerShape(); eth->applyTriggerShape();