From 1bad5f304744a4dbd8428e468ac40c9fbafaf064 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 23 Apr 2020 19:38:14 -0700 Subject: [PATCH] don't store self stim in config (#1356) * kill * add bench test * fix --- firmware/config/engines/custom_engine.cpp | 6 ------ firmware/controllers/algo/engine.h | 2 ++ firmware/controllers/algo/engine_configuration.cpp | 4 ---- firmware/controllers/bench_test.cpp | 3 +++ firmware/controllers/engine_controller.cpp | 2 +- firmware/controllers/settings.cpp | 2 +- firmware/controllers/trigger/trigger_central.cpp | 2 +- .../controllers/trigger/trigger_emulator_algo.cpp | 11 +++++++---- firmware/integration/rusefi_config.txt | 2 +- firmware/tunerstudio/rusefi.input | 3 ++- 10 files changed, 18 insertions(+), 19 deletions(-) diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index dbf71f89fd..c7445efb17 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -196,8 +196,6 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); - engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation - engineConfiguration->triggerSimulatorFrequency = 300; engineConfiguration->cranking.rpm = 100; @@ -313,8 +311,6 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL; - engineConfiguration->directSelfStimulation = true; - #if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG engineConfiguration->ignitionPins[0] = GPIOG_3; engineConfiguration->ignitionPins[1] = GPIOG_4; @@ -403,8 +399,6 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { */ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) { #if (BOARD_TLE8888_COUNT > 0) - engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation - engineConfiguration->debugMode = DBG_TLE8888; engineConfiguration->triggerSimulatorFrequency = 60; diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 9cd9ea97fe..88238e2473 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -260,6 +260,8 @@ public: */ bool isTestMode = false; + bool directSelfStimulation = false; + void resetEngineSnifferIfInTestMode(); /** diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index c98954738b..b6db9ec725 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -921,7 +921,6 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->mapHighValueVoltage = 5; engineConfiguration->logFormat = LF_NATIVE; - engineConfiguration->directSelfStimulation = false; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; @@ -1114,9 +1113,6 @@ void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallb setBoardConfigurationOverrides(); #endif -#if EFI_SIMULATOR - engineConfiguration->directSelfStimulation = true; -#endif /* */ engineConfiguration->engineType = engineType; /** diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 3a8ce409ed..a15b460fcc 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -261,6 +261,9 @@ static void handleCommandX14(uint16_t index) { case 0xC: engine->etbAutoTune = true; return; + case 0xD: + engine->directSelfStimulation = true; + return; } } diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index be640bbad7..eac2ee330c 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -272,7 +272,7 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE); } - if (CONFIG(directSelfStimulation) || engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { + if (ENGINE(directSelfStimulation) || engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { /** * rusEfi usually runs on hardware which halts execution while writing to internal flash, so we * postpone writes to until engine is stopped. Writes in case of self-stimulation are fine. diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index bddc430f65..d9ccc36e33 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -972,7 +972,7 @@ static void enableOrDisable(const char *param, bool isEnabled) { } else if (strEqualCaseInsensitive(param, "ignition")) { engineConfiguration->isIgnitionEnabled = isEnabled; } else if (strEqualCaseInsensitive(param, "self_stimulation")) { - engineConfiguration->directSelfStimulation = isEnabled; + engine->directSelfStimulation = isEnabled; } else if (strEqualCaseInsensitive(param, "engine_control")) { engineConfiguration->isEngineControlEnabled = isEnabled; } else if (strEqualCaseInsensitive(param, "map_avg")) { diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 5d61bfc003..c6b7dc2c80 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -605,7 +605,7 @@ void triggerInfo(void) { boolToString(ts->isSynchronizationNeeded), boolToString(isTriggerDecoderError()), engine->triggerCentral.triggerState.totalTriggerErrorCounter, engine->triggerCentral.triggerState.orderingErrorCounter, engine->triggerCentral.triggerState.getTotalRevolutionCounter(), - boolToString(engineConfiguration->directSelfStimulation)); + boolToString(engine->directSelfStimulation)); if (TRIGGER_WAVEFORM(isSynchronizationNeeded)) { scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_WAVEFORM(syncronizationRatioFrom[0]), TRIGGER_WAVEFORM(syncronizationRatioTo[0])); diff --git a/firmware/controllers/trigger/trigger_emulator_algo.cpp b/firmware/controllers/trigger/trigger_emulator_algo.cpp index 7363951cb2..adfefd0cbe 100644 --- a/firmware/controllers/trigger/trigger_emulator_algo.cpp +++ b/firmware/controllers/trigger/trigger_emulator_algo.cpp @@ -139,15 +139,18 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c if (!isEmulating) { return; } -#if EFI_PROD_CODE - applyPinState(stateIndex, state); -#endif /* EFI_PROD_CODE */ - if (engineConfiguration->directSelfStimulation) { + + if (engine->directSelfStimulation) { /** * this callback would invoke the input signal handlers directly */ helper.handleEmulatorCallback(state, stateIndex); } + +#if EFI_PROD_CODE + applyPinState(stateIndex, state); +#endif /* EFI_PROD_CODE */ + } static void setEmulatorAtIndex(int index) { diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 1f7a6470a5..f0b41ed20b 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -354,7 +354,7 @@ end_struct injector_s injector -bit directSelfStimulation;+Should trigger emulator push data right into trigger handling logic, eliminating the need for physical jumper wires?\nSee also triggerSimulatorPins\nPS: Funny name, right? :) +bit unused76b0; bit activateAuxPid1; bit isVerboseAuxPid1; bit activateAuxPid2; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index c0d50dd69b..74e5dce532 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1458,6 +1458,7 @@ cmd_test_ac_relay = "w\x00\x14\x00\x09" cmd_write_config = "w\x00\x14\x00\x0A" cmd_test_starter_relay = "w\x00\x14\x00\x0B" cmd_etb_autotune = "w\x00\x14\x00\x0C" +cmd_enable_self_stim = "w\x00\x14\x00\x0D" cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01" @@ -2832,7 +2833,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" ; Board->ECU stimulator dialog = ecuStimulator, "ECU stimulator" field = "Trigger Simulator", triggerSimulatorFrequency - field = "self-stimulation", directSelfStimulation + commandButton = "Enable Internal Trigger Simulation", cmd_enable_self_stim field = "" field = "digipot spi", digitalPotentiometerSpiDevice field = "digipot CS #0", digitalPotentiometerChipSelect1