another approach to #564 defect

This commit is contained in:
rusefi 2018-02-03 17:08:07 -05:00
parent 9027c0df1c
commit 34cf8506a7
1 changed files with 4 additions and 6 deletions

View File

@ -19,7 +19,6 @@
#include "trigger_emulator_algo.h" #include "trigger_emulator_algo.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "LocalVersionHolder.h"
#include "trigger_central.h" #include "trigger_central.h"
#include "trigger_simulator.h" #include "trigger_simulator.h"
@ -87,7 +86,7 @@ static int stopEmulationAtIndex = DO_NOT_STOP;
static bool isEmulating = true; static bool isEmulating = true;
static Logging *logger; static Logging *logger;
static LocalVersionHolder emulatorConfigVersion; static int atTriggerVersion = 0;
#if EFI_ENGINE_SNIFFER #if EFI_ENGINE_SNIFFER
#include "engine_sniffer.h" #include "engine_sniffer.h"
@ -116,12 +115,11 @@ void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
} }
static void updateTriggerShapeIfNeeded(PwmConfig *state) { static void updateTriggerShapeIfNeeded(PwmConfig *state) {
if (emulatorConfigVersion.isOld()) { if (atTriggerVersion < engine->triggerCentral.triggerShape.version) {
scheduleMsg(logger, "Stimulator: updating trigger shape: %d/%d %d", emulatorConfigVersion.getVersion(), atTriggerVersion = engine->triggerCentral.triggerShape.version;
scheduleMsg(logger, "Stimulator: updating trigger shape: %d/%d %d", atTriggerVersion,
getGlobalConfigurationVersion(), currentTimeMillis()); getGlobalConfigurationVersion(), currentTimeMillis());
// kludge: this line affects not trigger emulation but actual trigger consumption
refreshTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX);
TriggerShape *s = &engine->triggerCentral.triggerShape; TriggerShape *s = &engine->triggerCentral.triggerShape;
pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates, pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { s->wave.waves[0].pinStates, s->wave.waves[1].pinStates,