onConfigurationChangeTriggerCallback() (#448)
* onConfigurationChangeTriggerCallback() * conform isTriggerConfigChanged * #if EFI_EMULATE_POSITION_SENSORS * Now it works! * svnversion
This commit is contained in:
parent
a65e575614
commit
1a7e5b20d9
|
@ -170,6 +170,9 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
onConfigurationChangeIdleCallback(&activeConfiguration);
|
||||
#endif /* EFI_IDLE_CONTROL */
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
onConfigurationChangeTriggerCallback(&activeConfiguration);
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
||||
rememberCurrentConfiguration();
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
|||
|
||||
if (trgEventIndex == 0) {
|
||||
|
||||
if (triggerVersion.isOld()) {
|
||||
if (checkIfTriggerConfigChanged()) {
|
||||
engine->ignitionEvents.isReady = false; // we need to rebuild ignition schedule
|
||||
engine->injectionEvents.isReady = false;
|
||||
// todo: move 'triggerIndexByAngle' change into trigger initialization, why is it invoked from here if it's only about trigger shape & optimization?
|
||||
|
|
|
@ -78,6 +78,7 @@ uint32_t triggerMaxDuration = 0;
|
|||
|
||||
static bool isInsideTriggerHandler = false;
|
||||
|
||||
static bool isTriggerConfigChanged = false;
|
||||
|
||||
efitick_t previousVvtCamTime = 0;
|
||||
efitick_t previousVvtCamDuration = 0;
|
||||
|
@ -541,6 +542,32 @@ static void resetRunningTriggerCounters() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#define COMPARE_CONFIG_PARAMS(param) (engineConfiguration->param != previousConfiguration->param)
|
||||
|
||||
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration) {
|
||||
isTriggerConfigChanged = COMPARE_CONFIG_PARAMS(trigger.type) ||
|
||||
COMPARE_CONFIG_PARAMS(operationMode) ||
|
||||
COMPARE_CONFIG_PARAMS(useOnlyRisingEdgeForTrigger) ||
|
||||
COMPARE_CONFIG_PARAMS(globalTriggerAngleOffset) ||
|
||||
COMPARE_CONFIG_PARAMS(trigger.customTotalToothCount) ||
|
||||
COMPARE_CONFIG_PARAMS(trigger.customSkippedToothCount) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.triggerInputPins[0]) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.triggerInputPins[1]) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.triggerInputPins[2]) ||
|
||||
COMPARE_CONFIG_PARAMS(camInput) ||
|
||||
COMPARE_CONFIG_PARAMS(vvtMode) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.vvtCamSensorUseRise) ||
|
||||
COMPARE_CONFIG_PARAMS(vvtOffset) ||
|
||||
COMPARE_CONFIG_PARAMS(vvtDisplayInverted) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.nb2ratioFrom) ||
|
||||
COMPARE_CONFIG_PARAMS(bc.nb2ratioTo) ||
|
||||
COMPARE_CONFIG_PARAMS(nbVvtIndex);
|
||||
}
|
||||
|
||||
bool checkIfTriggerConfigChanged(void) {
|
||||
return isTriggerConfigChanged;
|
||||
}
|
||||
|
||||
void initTriggerCentral(Logging *sharedLogger) {
|
||||
logger = sharedLogger;
|
||||
strcpy((char*) shaft_signal_msg_index, "x_");
|
||||
|
|
|
@ -63,4 +63,7 @@ void addTriggerEventListener(ShaftPositionListener handler, const char *name, En
|
|||
int isSignalDecoderError(void);
|
||||
void resetMaxValues();
|
||||
|
||||
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration);
|
||||
bool checkIfTriggerConfigChanged(void);
|
||||
|
||||
#endif /* TRIGGER_CENTRAL_H_ */
|
||||
|
|
|
@ -121,7 +121,7 @@ void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
}
|
||||
|
||||
static void updateTriggerShapeIfNeeded(PwmConfig *state) {
|
||||
if (emulatorConfigVersion.isOld()) {
|
||||
if (checkIfTriggerConfigChanged()) {
|
||||
scheduleMsg(logger, "Stimulator: updating trigger shape: %d/%d %d", emulatorConfigVersion.getVersion(),
|
||||
getGlobalConfigurationVersion(), currentTimeMillis());
|
||||
|
||||
|
|
Loading…
Reference in New Issue