All live data not just outputs to be available in Lua #4866

This commit is contained in:
rusefillc 2022-12-04 14:53:45 -05:00
parent 98626bfa9d
commit 3d791304f1
5 changed files with 10 additions and 5 deletions

View File

@ -4,5 +4,4 @@ java -DSystemOut.name=logs/gen_output_channels \
-jar ../java_tools/ConfigDefinition.jar \
-prepend integration/rusefi_config.txt \
-definition console/binary/output_channels.txt \
-output_lookup_file controllers/lua/generated/output_lookup_generated.cpp \
-ts_outputs_section console/binary/

Binary file not shown.

View File

@ -110,9 +110,6 @@ public class ConfigDefinition {
case "-field_lookup_file":
state.destinations.add(new GetConfigValueConsumer(args[i + 1]));
break;
case "-output_lookup_file":
state.destinations.add(new GetOutputValueConsumer(args[i + 1]));
break;
case "-readfile":
String keyName = args[i + 1];
// yes, we take three parameters here thus pre-increment!

View File

@ -88,6 +88,8 @@ public class LiveDataProcessor {
SdCardFieldsContent sdCardFieldsConsumer = new SdCardFieldsContent();
GetOutputValueConsumer outputValueConsumer = new GetOutputValueConsumer("controllers/lua/generated/output_lookup_generated.cpp");
EntryHandler handler = new EntryHandler() {
@Override
public void onEntry(String name, String javaName, String folder, String prepend, boolean withCDefines, String[] outputNames, String constexpr) throws IOException {
@ -120,6 +122,9 @@ public class LiveDataProcessor {
if (constexpr != null) {
sdCardFieldsConsumer.home = constexpr;
state.addDestination(sdCardFieldsConsumer::handleEndStruct);
outputValueConsumer.currentSectionPrefix = constexpr;
state.addDestination(outputValueConsumer::handleEndStruct);
}
state.doJob();
@ -194,6 +199,8 @@ public class LiveDataProcessor {
SdCardFieldsConsumer.wrapContent(lazyFile, sdCardFieldsConsumer.getBody());
lazyFile.close();
outputValueConsumer.endFile();
totalSensors.append(javaSensorsConsumer.getContent());
return javaSensorsConsumer.sensorTsPosition;

View File

@ -22,6 +22,8 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
private final List<Pair<String, String>> getterPairs = new ArrayList<>();
private final String fileName;
public String currentSectionPrefix = "engine->outputChannels";
public GetOutputValueConsumer(String fileName) {
this.fileName = fileName;
}
@ -46,7 +48,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
}
String userName = prefix + cf.getName();
String javaName = "engine->outputChannels." + prefix;
String javaName = currentSectionPrefix + "." + prefix;
getterPairs.add(new Pair<>(userName, javaName + cf.getName()));