diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index f1de7dfb94..47449b9ffc 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -364,6 +364,9 @@ #define clutchUpPinInverted_offset_hex 3d0 #define clutchUpPinMode_offset 971 #define clutchUpPinMode_offset_hex 3cb +#define CMD_DISABLE "disable" +#define CMD_ENABLE "enable" +#define CMD_TRIGGER_HW_INPUT "trigger_hw_input" #define CMD_TRIGGERINFO "triggerinfo" #define CMD_WRITECONFIG "writeconfig" #define coastingFuelCutClt_offset 3154 diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 6296772bd4..98515e63ab 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -869,9 +869,13 @@ static void setSpiMode(int index, bool mode) { printSpiState(&logger, boardConfiguration); } +extern bool hwTriggerInputEnabled; + static void enableOrDisable(const char *param, bool isEnabled) { if (strEqualCaseInsensitive(param, "fastadc")) { boardConfiguration->isFastAdcEnabled = isEnabled; + } else if (strEqualCaseInsensitive(param, CMD_TRIGGER_HW_INPUT)) { + hwTriggerInputEnabled = isEnabled; } else if (strEqualCaseInsensitive(param, "etb_auto")) { engine->etbAutoTune = isEnabled; } else if (strEqualCaseInsensitive(param, "cranking_constant_dwell")) { @@ -1376,8 +1380,8 @@ void initSettings(void) { addConsoleActionI("enable_spi", enableSpi); addConsoleActionI("disable_spi", disableSpi); - addConsoleActionS("enable", enable); - addConsoleActionS("disable", disable); + addConsoleActionS(CMD_ENABLE, enable); + addConsoleActionS(CMD_DISABLE, disable); addConsoleActionII("set_toothed_wheel", setToothedWheel); diff --git a/firmware/hw_layer/trigger_input.cpp b/firmware/hw_layer/trigger_input.cpp index 393e77ffbc..3dc74f8d78 100644 --- a/firmware/hw_layer/trigger_input.cpp +++ b/firmware/hw_layer/trigger_input.cpp @@ -20,6 +20,7 @@ volatile int icuWidthCallbackCounter = 0; volatile int icuWidthPeriodCounter = 0; +bool hwTriggerInputEnabled = true; // this is useful at least for real hardware integration testing #if EFI_SHAFT_POSITION_INPUT && (HAL_TRIGGER_USE_PAL == TRUE || HAL_USE_ICU == TRUE) && (HAL_USE_COMP == FALSE) @@ -132,6 +133,9 @@ static void cam_icu_period_callback(ICUDriver *icup) { * 'width' events happens before the 'period' event */ static void shaft_icu_width_callback(ICUDriver *icup) { + if (!hwTriggerInputEnabled) { + return; + } icuWidthCallbackCounter++; // todo: support for 3rd trigger input channel // todo: start using real event time from HW event, not just software timer? @@ -149,6 +153,9 @@ static void shaft_icu_width_callback(ICUDriver *icup) { } static void shaft_icu_period_callback(ICUDriver *icup) { + if (!hwTriggerInputEnabled) { + return; + } icuWidthPeriodCounter++; if (hasFirmwareErrorFlag) return; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 487e78f46f..8c502444c9 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1227,6 +1227,9 @@ end_struct #define CMD_TRIGGERINFO "triggerinfo" #define CMD_WRITECONFIG "writeconfig" +#define CMD_ENABLE "enable" +#define CMD_DISABLE "disable" +#define CMD_TRIGGER_HW_INPUT "trigger_hw_input" #define PROTOCOL_ANALOG_CHART "analog_chart" #define PROTOCOL_ENGINE_SNIFFER "wave_chart" diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index 9da21f1fe1..1d39dc99a3 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -13,6 +13,7 @@ import com.rusefi.waves.EngineReport; import static com.rusefi.TestingUtils.nextChart; import static com.rusefi.IoUtil.sleep; import static com.rusefi.TestingUtils.*; +import static com.rusefi.io.CommandQueue.disableCommand; import static com.rusefi.waves.EngineReport.isCloseEnough; /** @@ -38,6 +39,7 @@ public class AutoTest { }); sendCommand("fl 1"); // just in case it was disabled + sendCommand(disableCommand(Fields.CMD_TRIGGER_HW_INPUT)); testCustomEngine(); testMazdaMiata2003(); test2003DodgeNeon(); diff --git a/java_console/io/src/com/rusefi/io/CommandQueue.java b/java_console/io/src/com/rusefi/io/CommandQueue.java index 172bb11ebc..ca231e0bbb 100644 --- a/java_console/io/src/com/rusefi/io/CommandQueue.java +++ b/java_console/io/src/com/rusefi/io/CommandQueue.java @@ -1,6 +1,7 @@ package com.rusefi.io; import com.rusefi.FileLog; +import com.rusefi.config.generated.Fields; import com.rusefi.core.MessagesCentral; import org.jetbrains.annotations.NotNull; @@ -209,4 +210,8 @@ public class CommandQueue { public interface CommandQueueListener { void onCommand(String command); } + + public static String disableCommand(String command) { + return Fields.CMD_DISABLE + " " + command; + } } diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 026784524f..436fa2ce0d 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sun Jul 14 15:12:56 EDT 2019 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sun Jul 14 15:33:42 EDT 2019 import com.rusefi.config.*; @@ -233,6 +233,9 @@ public class Fields { public static final int clutchUpPin_offset = 969; public static final int clutchUpPinInverted_offset = 976; public static final int clutchUpPinMode_offset = 971; + public static final String CMD_DISABLE = "disable"; + public static final String CMD_ENABLE = "enable"; + public static final String CMD_TRIGGER_HW_INPUT = "trigger_hw_input"; public static final String CMD_TRIGGERINFO = "triggerinfo"; public static final String CMD_WRITECONFIG = "writeconfig"; public static final int coastingFuelCutClt_offset = 3154; diff --git a/java_console/ui/src/com/rusefi/ui/RecentCommands.java b/java_console/ui/src/com/rusefi/ui/RecentCommands.java index 25a65a6f04..853b4c865f 100644 --- a/java_console/ui/src/com/rusefi/ui/RecentCommands.java +++ b/java_console/ui/src/com/rusefi/ui/RecentCommands.java @@ -1,6 +1,5 @@ package com.rusefi.ui; -import com.rusefi.AverageAngles; import com.rusefi.AverageAnglesUtil; import com.rusefi.FileLog; import com.rusefi.config.generated.Fields; @@ -20,6 +19,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import static com.rusefi.config.generated.Fields.CMD_TRIGGERINFO; +import static com.rusefi.io.CommandQueue.disableCommand; import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; /** @@ -127,9 +127,9 @@ public class RecentCommands { add(Fields.CMD_WRITECONFIG); add("rewriteconfig"); add("enable injection"); - add("disable injection"); + add(disableCommand("injection")); add("enable ignition"); - add("disable ignition"); + add(disableCommand("ignition")); add("enable self_stimulation"); add("disable self_stimulation");