Make hard-coded gap ratios visible on trigger documentation images #4172

This commit is contained in:
rusefillc 2022-07-12 01:41:35 -04:00
parent 5fe87f091b
commit 76762318cc
1 changed files with 21 additions and 11 deletions

View File

@ -7,10 +7,7 @@ import java.io.*;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.rusefi.config.generated.Fields.TRIGGER_IS_CRANK_KEY; import static com.rusefi.config.generated.Fields.*;
import static com.rusefi.config.generated.Fields.TRIGGER_IS_SECOND_WHEEL_CAM;
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 { public class TriggerWheelInfo {
private static final String TRIGGERTYPE = "TRIGGERTYPE"; private static final String TRIGGERTYPE = "TRIGGERTYPE";
@ -29,7 +26,7 @@ public class TriggerWheelInfo {
boolean isCrankBased, boolean isCrankBased,
boolean isSecondWheelCam, boolean isSecondWheelCam,
boolean hasSecondChannel, boolean hasSecondChannel,
boolean hardcodedOperationMode) { boolean hardcodedOperationMode, int gapTrackingLength) {
this.id = id; this.id = id;
this.isSecondWheelCam = isSecondWheelCam; this.isSecondWheelCam = isSecondWheelCam;
this.tdcPosition = tdcPosition; this.tdcPosition = tdcPosition;
@ -57,6 +54,7 @@ public class TriggerWheelInfo {
boolean isSecondWheelCam = false; boolean isSecondWheelCam = false;
boolean hasSecondChannel = false; boolean hasSecondChannel = false;
boolean hardcodedOperationMode = false; boolean hardcodedOperationMode = false;
int gapTrackingLength = 0;
while (true) { while (true) {
line = reader.readLine(); line = reader.readLine();
if (line == null || line.trim().startsWith("#")) if (line == null || line.trim().startsWith("#"))
@ -64,18 +62,29 @@ public class TriggerWheelInfo {
String[] keyValue = line.split("="); String[] keyValue = line.split("=");
if (keyValue.length != 2) if (keyValue.length != 2)
throw new IllegalStateException("Key/value lines expected: [" + line + "]"); throw new IllegalStateException("Key/value lines expected: [" + line + "]");
switch (keyValue[0]) { String key = keyValue[0];
if (key.startsWith(TRIGGER_GAP_FROM)) {
continue;
}
if (key.startsWith(TRIGGER_GAP_TO)) {
continue;
}
String value = keyValue[1];
switch (key) {
case TRIGGER_GAPS_COUNT:
gapTrackingLength = Integer.parseInt(value);
break;
case TRIGGER_IS_CRANK_KEY: case TRIGGER_IS_CRANK_KEY:
isCrankBased = Boolean.parseBoolean(keyValue[1]); isCrankBased = Boolean.parseBoolean(value);
break; break;
case TRIGGER_IS_SECOND_WHEEL_CAM: case TRIGGER_IS_SECOND_WHEEL_CAM:
isSecondWheelCam = Boolean.parseBoolean(keyValue[1]); isSecondWheelCam = Boolean.parseBoolean(value);
break; break;
case TRIGGER_HAS_SECOND_CHANNEL: case TRIGGER_HAS_SECOND_CHANNEL:
hasSecondChannel = Boolean.parseBoolean(keyValue[1]); hasSecondChannel = Boolean.parseBoolean(value);
break; break;
case TRIGGER_HARDCODED_OPERATION_MODE: case TRIGGER_HARDCODED_OPERATION_MODE:
hardcodedOperationMode = Boolean.parseBoolean(keyValue[1]); hardcodedOperationMode = Boolean.parseBoolean(value);
break; break;
default: default:
throw new IllegalStateException("Unexpected key/value: " + line); throw new IllegalStateException("Unexpected key/value: " + line);
@ -89,7 +98,8 @@ public class TriggerWheelInfo {
isCrankBased, isCrankBased,
isSecondWheelCam, isSecondWheelCam,
hasSecondChannel, hasSecondChannel,
hardcodedOperationMode hardcodedOperationMode,
gapTrackingLength
); );
} }