too many files have complete VariableRegistry, let's extract java snapshot of VariableRegistry into a separate file
only:uaefi
This commit is contained in:
parent
ea7867ba6f
commit
e1533e6d03
|
@ -15,7 +15,8 @@ java -DSystemOut.name=logs/gen_live_documentation \
|
|||
integration/LiveData.yaml${EXTRA_LIVE_DATA_FILE} \
|
||||
integration/rusefi_config_trigger.txt \
|
||||
../unit_tests/test-framework/trigger_meta_generated.h \
|
||||
../java_tools/trigger-image/src/main/java/com/rusefi/config/generated/TriggerMeta.java \
|
||||
../java_tools/trigger-image/src/main/java/com/rusefi/config/generated/ \
|
||||
TriggerMeta.java \
|
||||
"./${META_OUTPUT_ROOT_FOLDER}"
|
||||
[ $? -eq 0 ] || { echo "ERROR generating with LiveDataProcessor"; exit 1; }
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.*;
|
|||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.binaryprotocol.IoHelper.*;
|
||||
import static com.rusefi.config.generated.Fields.*;
|
||||
import static com.rusefi.config.generated.VariableRegistryValues.*;
|
||||
|
||||
/**
|
||||
* This object represents logical state of physical connection.
|
||||
|
@ -311,7 +311,7 @@ public class BinaryProtocol {
|
|||
return ConfigurationImageWithMeta.VOID;
|
||||
|
||||
int remainingSize = image.getSize() - offset;
|
||||
int requestSize = Math.min(remainingSize, Fields.BLOCKING_FACTOR);
|
||||
int requestSize = Math.min(remainingSize, BLOCKING_FACTOR);
|
||||
|
||||
byte[] packet = new byte[4];
|
||||
ByteRange.packOffsetAndSize(offset, requestSize, packet);
|
||||
|
@ -591,7 +591,7 @@ public class BinaryProtocol {
|
|||
|
||||
while (remaining > 0) {
|
||||
// If less than one full chunk left, do a smaller read
|
||||
int chunkSize = Math.min(remaining, Fields.BLOCKING_FACTOR);
|
||||
int chunkSize = Math.min(remaining, BLOCKING_FACTOR);
|
||||
|
||||
byte[] response = executeCommand(
|
||||
Integration.TS_OUTPUT_COMMAND,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -200,7 +200,7 @@ public class EngineSnifferPanel {
|
|||
public void displayChart(String value) {
|
||||
EngineChart map = EngineChartParser.unpackToMap(value);
|
||||
|
||||
StringBuilder revolutions = map.get(Fields.TOP_DEAD_CENTER_MESSAGE);
|
||||
StringBuilder revolutions = map.get(TOP_DEAD_CENTER_MESSAGE);
|
||||
|
||||
statusPanel.setRevolutions(revolutions);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.opensr5.ini.field.StringIniField;
|
|||
import com.rusefi.ConnectionTab;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.config.generated.VariableRegistryValues;
|
||||
import com.rusefi.core.ui.AutoupdateUtil;
|
||||
import com.rusefi.io.ConnectionStatusLogic;
|
||||
import com.rusefi.io.LinkManager;
|
||||
|
@ -298,7 +299,7 @@ public class LuaScriptPanel {
|
|||
log.info("Sending " + field);
|
||||
do {
|
||||
remaining = paddedScript.length - idx;
|
||||
int thisWrite = Math.min(remaining, Fields.BLOCKING_FACTOR);
|
||||
int thisWrite = Math.min(remaining, VariableRegistryValues.BLOCKING_FACTOR);
|
||||
|
||||
bp.writeData(paddedScript, idx, field.getOffset() + idx, thisWrite);
|
||||
|
||||
|
|
|
@ -97,7 +97,9 @@ public class ConfigDefinition {
|
|||
state.destCDefinesFileName = args[i + 1];
|
||||
break;
|
||||
case KEY_JAVA_DESTINATION:
|
||||
state.addJavaDestination(args[i + 1] + "Fields.java");
|
||||
String folderName = args[i + 1];
|
||||
state.addJavaDestination(folderName + "Fields.java");
|
||||
state.addDestination(new FileJavaVariableRegistryConsumer(state, folderName, LazyFile.REAL, "VariableRegistryValues"));
|
||||
break;
|
||||
case "-field_lookup_file": {
|
||||
String cppFile = args[i + 1];
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.config.generated.TriggerMeta.IGNITION_OUTPUT;
|
||||
import static com.rusefi.config.generated.TriggerVariableRegistryValues.IGNITION_OUTPUT;
|
||||
|
||||
/**
|
||||
* Andrey Belomutskiy, (c) 2012-2016
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.output.FileJavaVariableRegistryConsumer;
|
||||
import com.rusefi.util.LazyFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TriggerMetaGenerator {
|
||||
public static void doJob(String definitionInputFileName, String headerFileName, String javaDestinationFileName) throws IOException {
|
||||
public static void doJob(String definitionInputFileName, String headerFileName, String javaDestinationFolder, String javaDestinationFileName) throws IOException {
|
||||
System.out.println("Running with definitionInputFileName=[" + definitionInputFileName + "]");
|
||||
System.out.println("Running with headerFileName=[" + headerFileName + "]");
|
||||
System.out.println("Running with javaDestinationFileName=[" + javaDestinationFileName + "]");
|
||||
ReaderStateImpl reader = new ReaderStateImpl();
|
||||
reader.setDefinitionInputFile(definitionInputFileName);
|
||||
reader.addCHeaderDestination(headerFileName);
|
||||
reader.addJavaDestination(javaDestinationFileName);
|
||||
reader.addJavaDestination(javaDestinationFolder + javaDestinationFileName);
|
||||
reader.addDestination(new FileJavaVariableRegistryConsumer(reader, javaDestinationFolder, LazyFile.REAL, "TriggerVariableRegistryValues"));
|
||||
reader.doJob();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class LiveDataProcessor {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length != 5) {
|
||||
System.err.println("Five arguments expected: name of live data yaml input file and else but got " + args.length + ": " + Arrays.toString(args));
|
||||
if (args.length != 6) {
|
||||
System.err.println("Six arguments expected: name of live data yaml input file and else but got " + args.length + ": " + Arrays.toString(args));
|
||||
System.exit(-1);
|
||||
}
|
||||
log.info("Invoked with " + Arrays.toString(args));
|
||||
|
@ -64,9 +64,10 @@ public class LiveDataProcessor {
|
|||
log.info("yamlFileNames=" + yamlFileNames);
|
||||
String definitionInputFileName = args[1];
|
||||
String headerFileName = args[2];
|
||||
String javaDestinationFileName = args[3];
|
||||
String destinationFolder = args[4];
|
||||
TriggerMetaGenerator.doJob(definitionInputFileName, headerFileName, javaDestinationFileName);
|
||||
String javaDestinationFolder = args[3];
|
||||
String javaDestinationFileName = args[4];
|
||||
String destinationFolder = args[5];
|
||||
TriggerMetaGenerator.doJob(definitionInputFileName, headerFileName, javaDestinationFolder, javaDestinationFileName);
|
||||
List<LinkedHashMap> totalContent = new ArrayList<>();
|
||||
for (String fileName : yamlFileNames.split(",")) {
|
||||
List<LinkedHashMap> yamlContent = getStringObjectMap(new FileReader(fileName));
|
||||
|
|
|
@ -33,15 +33,19 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
|
|||
|
||||
@Override
|
||||
public void startFile() {
|
||||
writePackageLine(javaFields);
|
||||
javaFields.write("// this file " + state.getHeader() + ToolUtil.EOL + EOL);
|
||||
javaFields.write("// by " + getClass() + EOL);
|
||||
javaFields.write("import com.rusefi.config.*;" + EOL + EOL);
|
||||
writeClassOpenLine(javaFields, className);
|
||||
startJavaFile(javaFields, className, state, getClass());
|
||||
}
|
||||
|
||||
public static void writeClassOpenLine(LazyFile lazyFile, String className1) {
|
||||
lazyFile.write("public class " + className1 + " {" + ToolUtil.EOL);
|
||||
static void startJavaFile(LazyFile file, String className, ReaderState state, Class<?> clazz) {
|
||||
writePackageLine(file);
|
||||
file.write("// this file " + state.getHeader() + ToolUtil.EOL + EOL);
|
||||
file.write("// by " + clazz + EOL);
|
||||
file.write("import com.rusefi.config.*;" + EOL + EOL);
|
||||
writeClassOpenLine(file, className);
|
||||
}
|
||||
|
||||
public static void writeClassOpenLine(LazyFile lazyFile, String className) {
|
||||
lazyFile.write("public class " + className + " {" + ToolUtil.EOL);
|
||||
}
|
||||
|
||||
public static void writePackageLine(LazyFile lazyFile) {
|
||||
|
@ -49,7 +53,6 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
|
|||
}
|
||||
|
||||
public void endFile() throws IOException {
|
||||
javaFields.write(state.getVariableRegistry().getJavaConstants());
|
||||
javaFields.write(getContent());
|
||||
|
||||
if (allFields.length() > 0) {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.rusefi.output;
|
||||
|
||||
import com.rusefi.ReaderState;
|
||||
import com.rusefi.ReaderStateImpl;
|
||||
import com.rusefi.ToolUtil;
|
||||
import com.rusefi.util.LazyFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FileJavaVariableRegistryConsumer implements ConfigurationConsumer {
|
||||
private final String className;
|
||||
|
||||
private final LazyFile java;
|
||||
private final ReaderStateImpl state;
|
||||
|
||||
public FileJavaVariableRegistryConsumer(ReaderStateImpl state, String folderName, LazyFile.LazyFileFactory fileFactory, String className) {
|
||||
this.state = state;
|
||||
this.className = className;
|
||||
java = fileFactory.create(folderName + className + ".java");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFile() {
|
||||
FileJavaFieldsConsumer.startJavaFile(java, className, state, getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) {
|
||||
|
||||
}
|
||||
|
||||
public void endFile() throws IOException {
|
||||
java.write(state.getVariableRegistry().getJavaConstants());
|
||||
java.write("}" + ToolUtil.EOL);
|
||||
java.close();
|
||||
}
|
||||
}
|
|
@ -1,22 +1,9 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEFI tool config_definition_base.jar based on (unknown script) integration/rusefi_config_trigger.txt Sat Sep 16 04:04:27 UTC 2023
|
||||
// this file was generated automatically by rusEFI tool config_definition_base-all.jar based on (unknown script) integration/rusefi_config_trigger.txt
|
||||
|
||||
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
||||
public class TriggerMeta {
|
||||
public static final String IGNITION_OUTPUT = "Ignition Output";
|
||||
public static final String TRIGGER_COMMENT = "#";
|
||||
public static final String TRIGGER_CYCLE_DURATION = "cycleDuration";
|
||||
public static final String TRIGGER_GAP_FROM = "gapFrom";
|
||||
public static final String TRIGGER_GAP_TO = "gapTo";
|
||||
public static final String TRIGGER_GAPS_COUNT = "gapsCount";
|
||||
public static final String TRIGGER_HAS_SECOND_CHANNEL = "hasSecondChannel";
|
||||
public static final String TRIGGER_IS_CRANK_KEY = "crankBased";
|
||||
public static final String TRIGGER_IS_SECOND_WHEEL_CAM = "isSecondWheelCam";
|
||||
public static final String TRIGGER_KNOWN_OPERATION_MODE = "knownOperationMode";
|
||||
public static final String TRIGGER_SYNC_EDGE = "syncEdge";
|
||||
public static final String TRIGGER_WITH_SYNC = "isSynchronizationNeeded";
|
||||
public static final String TRIGGERS_FILE_NAME = "triggers.txt";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEFI tool config_definition_base-all.jar based on (unknown script) integration/rusefi_config_trigger.txt
|
||||
|
||||
// by class com.rusefi.output.FileJavaVariableRegistryConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
||||
public class TriggerVariableRegistryValues {
|
||||
public static final String IGNITION_OUTPUT = "Ignition Output";
|
||||
public static final String TRIGGER_COMMENT = "#";
|
||||
public static final String TRIGGER_CYCLE_DURATION = "cycleDuration";
|
||||
public static final String TRIGGER_GAP_FROM = "gapFrom";
|
||||
public static final String TRIGGER_GAP_TO = "gapTo";
|
||||
public static final String TRIGGER_GAPS_COUNT = "gapsCount";
|
||||
public static final String TRIGGER_HAS_SECOND_CHANNEL = "hasSecondChannel";
|
||||
public static final String TRIGGER_IS_CRANK_KEY = "crankBased";
|
||||
public static final String TRIGGER_IS_SECOND_WHEEL_CAM = "isSecondWheelCam";
|
||||
public static final String TRIGGER_KNOWN_OPERATION_MODE = "knownOperationMode";
|
||||
public static final String TRIGGER_SYNC_EDGE = "syncEdge";
|
||||
public static final String TRIGGER_WITH_SYNC = "isSynchronizationNeeded";
|
||||
public static final String TRIGGERS_FILE_NAME = "triggers.txt";
|
||||
}
|
|
@ -8,7 +8,8 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.rusefi.config.generated.TriggerMeta.*;
|
||||
|
||||
import static com.rusefi.config.generated.TriggerVariableRegistryValues.*;
|
||||
|
||||
public class TriggerWheelInfo {
|
||||
private static final Logging log = Logging.getLogging(TriggerWheelInfo.class);
|
||||
|
|
Loading…
Reference in New Issue