Proper cam speed labels in triggers #4021
This commit is contained in:
parent
dcd1419c59
commit
75318803e8
|
@ -45,7 +45,7 @@ java -DSystemOut.name=logs/gen_config_board \
|
|||
$COMMON_GEN_CONFIG \
|
||||
-romraider integration \
|
||||
-tool gen_config.sh \
|
||||
-field_lookup_file controllers/lua/generated/value_lookup_generated.cpp \
|
||||
-field_lookup_file controllers/lua/generated/value_lookup_generated.cpp \
|
||||
-board ${BOARDNAME} \
|
||||
-ts_output_name generated/${INI} \
|
||||
-signature tunerstudio/generated/signature_${SHORT_BOARDNAME}.txt \
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
COMMON_GEN_CONFIG="-jar ../java_tools/ConfigDefinition.jar \
|
||||
-enumInputFile controllers/algo/engine_types.h \
|
||||
-enumInputFile controllers/algo/rusefi_enums.h \
|
||||
|
@ -5,6 +6,7 @@ COMMON_GEN_CONFIG="-jar ../java_tools/ConfigDefinition.jar \
|
|||
-readfile DATALOG_SECTION console/binary/generated/data_logs.ini \
|
||||
-ts_destination tunerstudio \
|
||||
-firing_order controllers/algo/firing_order.h \
|
||||
-triggerFolder ../unit_tests \
|
||||
-with_c_defines false \
|
||||
-initialize_to_zero false \
|
||||
-definition integration/rusefi_config.txt"
|
||||
|
|
|
@ -1907,15 +1907,12 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
|
||||
; see also in firmware '[doesTriggerImplyOperationMode]' tag
|
||||
field = "What kind of engine", twoStroke
|
||||
field = "Skipped wheel location", skippedWheelOnCam, { twoStroke == 0 }
|
||||
field = "#Please use '4 stroke with cam' only if primary trigger sensor is actually on cam"
|
||||
field = "#Separate cam input not part of Trigger Pattern does not count here"
|
||||
field = "Skipped wheel location", skippedWheelOnCam, { twoStroke == 0 && (@@TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION@@) }
|
||||
field = "With VR sensors only rising edge has reliable position"
|
||||
field = "use only rising edge", useOnlyRisingEdgeForTrigger
|
||||
field = "!Reminder that 4-stroke cycle is 720 degrees"
|
||||
field = "!For well-known trigger types use '0' trigger angle offset"
|
||||
field = "Trigger Angle Advance", globalTriggerAngleOffset
|
||||
field = "Display logic signals", displayLogicLevelsInEngineSniffer
|
||||
|
||||
dialog = triggerConfiguration_gap, "Trigger Gap Override"
|
||||
field = "!This is a pretty advanced feature for when you are debugging trigger synchronization"
|
||||
|
@ -1955,11 +1952,16 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
|
||||
dialog = triggerInputs, "Trigger Inputs"
|
||||
field = "#Cam is primary if you have cam sensor as part of trigger shape"
|
||||
field = "Cam Sensor (Primary channel)", triggerInputPins1, 1, { ambiguousOperationMode == @@operation_mode_e_FOUR_STROKE_CAM_SENSOR@@ }
|
||||
field = "Crank Sensor (Primary channel)", triggerInputPins1, 1, { ambiguousOperationMode != @@operation_mode_e_FOUR_STROKE_CAM_SENSOR@@ }
|
||||
; cam if
|
||||
; two-stroke, or
|
||||
; trigger without known location and cam selected, or
|
||||
; ! trigger is crank based
|
||||
field = "Cam Sensor (Primary channel)", triggerInputPins1, 1, { twoStroke == 1 || ((@@TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION@@) && skippedWheelOnCam) || ! (@@TRIGGER_CRANK_BASED) }
|
||||
field = "Crank Sensor (Primary channel)", triggerInputPins1, 1, { !(twoStroke == 1 || ((@@TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION@@) && skippedWheelOnCam) || ! (@@TRIGGER_CRANK_BASED)) }
|
||||
|
||||
field = "Invert Primary", invertPrimaryTriggerSignal
|
||||
field = "Secondary channel", triggerInputPins2, { triggerInputPins1 != 0 && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_60_2@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_36_1@@ && trigger_type != @@trigger_type_e_TT_ONE@@ && trigger_type != @@trigger_type_e_TT_60_2_VW@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_36_2@@}
|
||||
field = "Invert Secondary", invertSecondaryTriggerSignal, { triggerInputPins2 != 0 && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_60_2@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_36_1@@ && trigger_type != @@trigger_type_e_TT_ONE@@ && trigger_type != @@trigger_type_e_TT_60_2_VW@@ && trigger_type != @@trigger_type_e_TT_TOOTHED_WHEEL_36_2@@}
|
||||
field = "Secondary channel", triggerInputPins2, { triggerInputPins1 != 0 && (@@TRIGGER_TYPE_WITH_SECOND_WHEEL)) }
|
||||
field = "Invert Secondary", invertSecondaryTriggerSignal, { triggerInputPins2 != 0 && (@@TRIGGER_TYPE_WITH_SECOND_WHEEL)) }
|
||||
field = "#VVT or Cam for 60/2 goes below"
|
||||
field = "#If your engine has no exhaust cam sensor, use intake cam inputs"
|
||||
field = "Cam sensor bank 1 intake", camInputs1, { vvtMode1 != @@vvt_mode_e_VVT_INACTIVE@@ }
|
||||
|
@ -1971,8 +1973,9 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
|
||||
|
||||
dialog = triggerConfiguration
|
||||
panel = triggerConfiguration_settings, North, { consumeObdSensors == 0 }
|
||||
panel = triggerInputs, South, { consumeObdSensors == 0 }
|
||||
panel = triggerConfiguration_settings, {1}, { consumeObdSensors == 0 }
|
||||
panel = triggerInputs, {1}, { consumeObdSensors == 0 }
|
||||
field = "Display logic signals", displayLogicLevelsInEngineSniffer
|
||||
|
||||
; Engine->Injection Settings
|
||||
dialog = injChars, "Injector Settings", yAxis
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.rusefi.trigger;
|
||||
|
||||
import com.rusefi.StartupFrame;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.enums.trigger_type_e;
|
||||
import com.rusefi.ui.engine.UpDownImage;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
|
@ -11,10 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -27,10 +23,8 @@ import java.util.List;
|
|||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
*/
|
||||
public class TriggerImage {
|
||||
private static final String TRIGGERTYPE = "TRIGGERTYPE";
|
||||
private static final String OUTPUT_FOLDER = "triggers";
|
||||
private static final String TOP_MESSAGE = StartupFrame.LINK_TEXT;
|
||||
private static final String DEFAULT_WORK_FOLDER = ".." + File.separator + "unit_tests";
|
||||
|
||||
private static final int WHEEL_BORDER = 20;
|
||||
private static final int WHEEL_DIAMETER = 500;
|
||||
|
@ -104,7 +98,7 @@ public class TriggerImage {
|
|||
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
|
||||
final String workingFolder;
|
||||
if (args.length < 1) {
|
||||
workingFolder = DEFAULT_WORK_FOLDER;
|
||||
workingFolder = TriggerWheelInfo.DEFAULT_WORK_FOLDER;
|
||||
} else {
|
||||
workingFolder = args[0];
|
||||
}
|
||||
|
@ -138,40 +132,12 @@ public class TriggerImage {
|
|||
});
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
try {
|
||||
generateImages(workingFolder, wheelInfo -> onWheel(triggerPanel, topPanel, content, wheelInfo));
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
TriggerWheelInfo.readWheels(workingFolder, wheelInfo -> onWheel(triggerPanel, topPanel, content, wheelInfo));
|
||||
});
|
||||
Thread.sleep(1000L * sleepAtEnd);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
private static void generateImages(String workingFolder, TriggerWheelInfo.TriggerWheelInfoConsumer consumer) throws IOException {
|
||||
String fileName = workingFolder + File.separator + Fields.TRIGGERS_FILE_NAME;
|
||||
BufferedReader br = new BufferedReader(new FileReader(fileName));
|
||||
|
||||
System.out.println("Reading " + fileName);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.trim().startsWith("#")) {
|
||||
// skipping a comment
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.startsWith(TRIGGERTYPE)) {
|
||||
readTrigger(br, line, consumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void readTrigger(BufferedReader reader, String line, TriggerWheelInfo.TriggerWheelInfoConsumer consumer) throws IOException {
|
||||
TriggerWheelInfo triggerWheelInfo = TriggerWheelInfo.readTriggerWheelInfo(line, reader);
|
||||
|
||||
consumer.onWheel(triggerWheelInfo);
|
||||
}
|
||||
|
||||
private static void onWheel(TriggerPanel triggerPanel, JPanel topPanel, JPanel content, TriggerWheelInfo triggerWheelInfo) {
|
||||
if (onlyOneTrigger != null && findByOrdinal(triggerWheelInfo.getId()) != onlyOneTrigger)
|
||||
return;
|
||||
|
|
Binary file not shown.
|
@ -3,6 +3,7 @@ package com.rusefi;
|
|||
import com.rusefi.newparse.ParseState;
|
||||
import com.rusefi.newparse.parsing.Definition;
|
||||
import com.rusefi.output.*;
|
||||
import com.rusefi.trigger.TriggerWheelTSLogic;
|
||||
import com.rusefi.util.IoUtils;
|
||||
import com.rusefi.util.SystemOut;
|
||||
|
||||
|
@ -72,6 +73,7 @@ public class ConfigDefinition {
|
|||
List<String> prependFiles = new ArrayList<>();
|
||||
String romRaiderInputFile = null;
|
||||
String firingEnumFileName = null;
|
||||
String triggersFolder = null;
|
||||
String signatureDestination = null;
|
||||
String signaturePrependFile = null;
|
||||
List<String> enumInputFiles = new ArrayList<>();
|
||||
|
@ -134,6 +136,9 @@ public class ConfigDefinition {
|
|||
firingEnumFileName = args[i + 1];
|
||||
inputFiles.add(firingEnumFileName);
|
||||
break;
|
||||
case "-triggerFolder":
|
||||
triggersFolder = args[i + 1];
|
||||
break;
|
||||
case KEY_ROMRAIDER_DESTINATION:
|
||||
romRaiderDestination = args[i + 1];
|
||||
break;
|
||||
|
@ -188,6 +193,8 @@ public class ConfigDefinition {
|
|||
|
||||
ExtraUtil.handleFiringOrder(firingEnumFileName, state.variableRegistry, parseState);
|
||||
|
||||
new TriggerWheelTSLogic().execute(triggersFolder, state.variableRegistry);
|
||||
|
||||
|
||||
for (String prependFile : prependFiles)
|
||||
state.variableRegistry.readPrependValues(prependFile);
|
||||
|
|
|
@ -21,6 +21,7 @@ public class FiringOrderTSLogic {
|
|||
private static final String FIRING_ORDER_PREFIX = "FO_";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// sandbox code
|
||||
invoke("../firmware/controllers/algo/firing_order.h");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.rusefi.trigger;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -13,23 +13,34 @@ import static com.rusefi.config.generated.Fields.TRIGGER_HAS_SECOND_CHANNEL;
|
|||
import static com.rusefi.config.generated.Fields.TRIGGER_HARDCODED_OPERATION_MODE;
|
||||
|
||||
public class TriggerWheelInfo {
|
||||
private static final String TRIGGERTYPE = "TRIGGERTYPE";
|
||||
static final String DEFAULT_WORK_FOLDER = ".." + File.separator + "unit_tests";
|
||||
|
||||
private final int id;
|
||||
private final boolean isSecondWheelCam;
|
||||
private final double tdcPosition;
|
||||
private final String triggerName;
|
||||
private final List<TriggerSignal> signals;
|
||||
private final boolean isCrankBased;
|
||||
private final boolean hasSecondChannel;
|
||||
private final boolean hardcodedOperationMode;
|
||||
|
||||
public TriggerWheelInfo(int id, double tdcPosition, String triggerName, List<TriggerSignal> signals, boolean isCrankBased, boolean isSecondWheelCam) {
|
||||
public TriggerWheelInfo(int id, double tdcPosition, String triggerName, List<TriggerSignal> signals,
|
||||
boolean isCrankBased,
|
||||
boolean isSecondWheelCam,
|
||||
boolean hasSecondChannel,
|
||||
boolean hardcodedOperationMode) {
|
||||
this.id = id;
|
||||
this.isSecondWheelCam = isSecondWheelCam;
|
||||
this.tdcPosition = tdcPosition;
|
||||
this.triggerName = triggerName;
|
||||
this.signals = signals;
|
||||
this.isCrankBased = isCrankBased;
|
||||
this.hasSecondChannel = hasSecondChannel;
|
||||
this.hardcodedOperationMode = hardcodedOperationMode;
|
||||
}
|
||||
|
||||
public static TriggerWheelInfo readTriggerWheelInfo(String line, BufferedReader reader) throws IOException {
|
||||
private static TriggerWheelInfo readTriggerWheelInfo(String line, BufferedReader reader) throws IOException {
|
||||
String[] tokens = line.split(" ");
|
||||
String idStr = tokens[1];
|
||||
int eventCount = Integer.parseInt(tokens[2]);
|
||||
|
@ -44,6 +55,8 @@ public class TriggerWheelInfo {
|
|||
|
||||
boolean isCrankBased = false;
|
||||
boolean isSecondWheelCam = false;
|
||||
boolean hasSecondChannel = false;
|
||||
boolean hardcodedOperationMode = false;
|
||||
while (true) {
|
||||
line = reader.readLine();
|
||||
if (line == null || line.trim().startsWith("#"))
|
||||
|
@ -59,9 +72,10 @@ public class TriggerWheelInfo {
|
|||
isSecondWheelCam = Boolean.parseBoolean(keyValue[1]);
|
||||
break;
|
||||
case TRIGGER_HAS_SECOND_CHANNEL:
|
||||
Boolean.parseBoolean(keyValue[1]);
|
||||
hasSecondChannel = Boolean.parseBoolean(keyValue[1]);
|
||||
break;
|
||||
case TRIGGER_HARDCODED_OPERATION_MODE:
|
||||
hardcodedOperationMode = Boolean.parseBoolean(keyValue[1]);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected key/value: " + line);
|
||||
|
@ -70,7 +84,38 @@ public class TriggerWheelInfo {
|
|||
|
||||
List<TriggerSignal> signals = TriggerSignalReader.readSignals(reader, eventCount);
|
||||
|
||||
return new TriggerWheelInfo(id, tdcPosition, triggerName, signals, isCrankBased, isSecondWheelCam);
|
||||
return new TriggerWheelInfo(id, tdcPosition, triggerName,
|
||||
signals,
|
||||
isCrankBased,
|
||||
isSecondWheelCam,
|
||||
hasSecondChannel,
|
||||
hardcodedOperationMode
|
||||
);
|
||||
}
|
||||
|
||||
static void readWheels(String workingFolder, TriggerWheelInfoConsumer consumer) {
|
||||
String fileName = workingFolder + File.separator + Fields.TRIGGERS_FILE_NAME;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(fileName));
|
||||
|
||||
System.out.println("Reading " + fileName);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.trim().startsWith("#")) {
|
||||
// skipping a comment
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.startsWith(TRIGGERTYPE)) {
|
||||
TriggerWheelInfo triggerWheelInfo = readTriggerWheelInfo(line, br);
|
||||
|
||||
consumer.onWheel(triggerWheelInfo);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -138,6 +183,18 @@ public class TriggerWheelInfo {
|
|||
return signals;
|
||||
}
|
||||
|
||||
public boolean isCrankBased() {
|
||||
return isCrankBased;
|
||||
}
|
||||
|
||||
public boolean isHasSecondChannel() {
|
||||
return hasSecondChannel;
|
||||
}
|
||||
|
||||
public boolean isHardcodedOperationMode() {
|
||||
return hardcodedOperationMode;
|
||||
}
|
||||
|
||||
public interface TriggerWheelInfoConsumer {
|
||||
void onWheel(TriggerWheelInfo wheelInfo);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.rusefi.trigger;
|
||||
|
||||
import com.rusefi.VariableRegistry;
|
||||
|
||||
import static com.rusefi.trigger.TriggerWheelInfo.DEFAULT_WORK_FOLDER;
|
||||
|
||||
public class TriggerWheelTSLogic {
|
||||
|
||||
private static final String TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION = "TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION";
|
||||
private static final String TRIGGER_TYPE_WITH_SECOND_WHEEL = "TRIGGER_TYPE_WITH_SECOND_WHEEL";
|
||||
private static final String TRIGGER_CRANK_BASED = "TRIGGER_CRANK_BASED";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// sandbox code
|
||||
VariableRegistry variableRegistry = new VariableRegistry();
|
||||
new TriggerWheelTSLogic().execute(DEFAULT_WORK_FOLDER, variableRegistry);
|
||||
}
|
||||
|
||||
public void execute(String folder, VariableRegistry variableRegistry) {
|
||||
if (folder == null) {
|
||||
System.out.println("Folder not specified");
|
||||
return;
|
||||
}
|
||||
StringBuilder triggerTypesWithoutKnownLocation = new StringBuilder();
|
||||
StringBuilder triggerTypesWithSecondWheel = new StringBuilder();
|
||||
StringBuilder triggerTypesCrankBased = new StringBuilder();
|
||||
|
||||
|
||||
TriggerWheelInfo.readWheels(folder, wheelInfo -> {
|
||||
System.out.println("onWheel " + wheelInfo.getTriggerName());
|
||||
|
||||
if (!wheelInfo.isHardcodedOperationMode()) {
|
||||
appendOrIfNotEmpty(triggerTypesWithoutKnownLocation);
|
||||
triggerTypesWithoutKnownLocation.append("trigger_type == ").append(wheelInfo.getId());
|
||||
}
|
||||
|
||||
if (wheelInfo.isHasSecondChannel()) {
|
||||
appendOrIfNotEmpty(triggerTypesWithSecondWheel);
|
||||
triggerTypesWithSecondWheel.append("trigger_type == ").append(wheelInfo.getId());
|
||||
}
|
||||
|
||||
if (wheelInfo.isCrankBased()) {
|
||||
appendOrIfNotEmpty(triggerTypesCrankBased);
|
||||
triggerTypesCrankBased.append("trigger_type == ").append(wheelInfo.getId());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
variableRegistry.register(TRIGGER_TYPE_WITHOUT_KNOWN_LOCATION, triggerTypesWithoutKnownLocation.toString());
|
||||
variableRegistry.register(TRIGGER_TYPE_WITH_SECOND_WHEEL, triggerTypesWithSecondWheel.toString());
|
||||
variableRegistry.register(TRIGGER_CRANK_BASED, triggerTypesCrankBased.toString());
|
||||
}
|
||||
|
||||
private void appendOrIfNotEmpty(StringBuilder triggerTypesWithSecondWheel) {
|
||||
if (triggerTypesWithSecondWheel.length() > 0)
|
||||
triggerTypesWithSecondWheel.append(" || ");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue