logging of live data structs was: data points #3614

huge step!
This commit is contained in:
rusefillc 2022-04-17 21:01:54 -04:00
parent c6780b8369
commit 73d5898c5e
6 changed files with 13 additions and 6 deletions

Binary file not shown.

View File

@ -223,7 +223,6 @@ public class ConfigDefinition {
* we have '-readfile OUTPUTS_SECTION' in one of .sh files in order to template rusefi.input
* Same with '-readfile DATALOG_SECTION'
*/
state.destinations.add(new OutputsSectionConsumer(tsOutputsDestination + File.separator + "generated/output_channels.ini"));
state.destinations.add(new DataLogConsumer(tsOutputsDestination + File.separator + "generated/data_logs.ini"));
state.destinations.add(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini"));
}

View File

@ -5,6 +5,7 @@ import com.rusefi.ConfigDefinition;
import com.rusefi.ReaderState;
import com.rusefi.output.FragmentDialogConsumer;
import com.rusefi.output.JavaSensorsConsumer;
import com.rusefi.output.OutputsSectionConsumer;
import org.yaml.snakeyaml.Yaml;
import java.io.File;
@ -69,6 +70,9 @@ public class UsagesReader {
private int handleYaml(Map<String, Object> data, EntryHandler _handler) throws IOException {
JavaSensorsConsumer javaSensorsConsumer = new JavaSensorsConsumer();
String tsOutputsDestination = "console/binary/";
OutputsSectionConsumer outputsSections = new OutputsSectionConsumer(tsOutputsDestination + File.separator + "generated/output_channels.ini");
EntryHandler handler = new EntryHandler() {
@ -101,7 +105,7 @@ public class UsagesReader {
state.setDefinitionInputFile(folder + File.separator + name + ".txt");
state.withC_Defines = withCDefines;
state.addDestination(javaSensorsConsumer);
state.addDestination(javaSensorsConsumer, outputsSections);
FragmentDialogConsumer fragmentDialogConsumer = new FragmentDialogConsumer(name);
state.addDestination(fragmentDialogConsumer);

View File

@ -14,7 +14,7 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
public OutputsSectionConsumer(String tsOutputsSectionFileName) {
this.tsOutputsSectionFileName = tsOutputsSectionFileName;
tsOutput = new TsOutput(false);
tsOutput = new TsOutput(false, false);
}
public String getContent() {

View File

@ -27,7 +27,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
public TSProjectConsumer(String tsPath, ReaderState state) {
this.tsPath = tsPath;
tsOutput = new TsOutput(true);
tsOutput = new TsOutput(true, true);
this.state = state;
}

View File

@ -18,10 +18,12 @@ import static com.rusefi.output.JavaSensorsConsumer.quote;
public class TsOutput {
private final StringBuilder settingContextHelp = new StringBuilder();
private final boolean isConstantsSection;
private final boolean registerOffsets;
private final StringBuilder tsHeader = new StringBuilder();
public TsOutput(boolean longForm) {
public TsOutput(boolean longForm, boolean registerOffsets) {
this.isConstantsSection = longForm;
this.registerOffsets = registerOffsets;
}
public String getContent() {
@ -51,7 +53,9 @@ public class TsOutput {
if (configField.getComment() != null && configField.getComment().trim().length() > 0 && cs == null) {
settingContextHelp.append("\t" + nameWithPrefix + " = \"" + configField.getCommentContent() + "\"" + EOL);
}
state.variableRegistry.register(nameWithPrefix + "_offset", tsPosition);
if (registerOffsets) {
state.variableRegistry.register(nameWithPrefix + "_offset", tsPosition);
}
if (cs != null) {
String extraPrefix = cs.withPrefix ? configField.getName() + "_" : "";