parent
1dc5788a2e
commit
ed98d7c4b4
|
@ -199,7 +199,7 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
egoCorrectionForVeAnalyze = { 100 + fuelPidCorrection1 }
|
egoCorrectionForVeAnalyze = { 100 + fuelPidCorrection1 }
|
||||||
|
|
||||||
wbo0_hasFault = { enableAemXSeries && (faultCode >= 3) }
|
wbo0_hasFault = { enableAemXSeries && (faultCode0 >= 3) }
|
||||||
|
|
||||||
[PcVariables]
|
[PcVariables]
|
||||||
tuneCrcPcVariable = continuousChannelValue, tuneCrc16
|
tuneCrcPcVariable = continuousChannelValue, tuneCrc16
|
||||||
|
@ -1658,7 +1658,7 @@ gaugeCategory = GPPWM Outputs
|
||||||
indicator = { isTriggerError}, "Trigger OK", "Trigger ERR", white, black, red, black
|
indicator = { isTriggerError}, "Trigger OK", "Trigger ERR", white, black, red, black
|
||||||
indicator = { fuelCutReason != 0 }, "Injection OK", { Fuel cut: bitStringValue(fuelIgnCutCodeList, fuelCutReason)}, white, black, yellow, black
|
indicator = { fuelCutReason != 0 }, "Injection OK", { Fuel cut: bitStringValue(fuelIgnCutCodeList, fuelCutReason)}, white, black, yellow, black
|
||||||
indicator = { sparkCutReason != 0 }, "Ignition OK", { Ign cut: bitStringValue(fuelIgnCutCodeList, sparkCutReason)}, white, black, yellow, black
|
indicator = { sparkCutReason != 0 }, "Ignition OK", { Ign cut: bitStringValue(fuelIgnCutCodeList, sparkCutReason)}, white, black, yellow, black
|
||||||
indicator = { etbErrorCode != 0 }, "ETB OK", { ETB: bitStringValue(etbCutCodeList, etbErrorCode)}, white, black, yellow, black
|
indicator = { etbErrorCode0 != 0 }, "ETB OK", { ETB: bitStringValue(etbCutCodeList, etbErrorCode0)}, white, black, yellow, black
|
||||||
|
|
||||||
; minor info
|
; minor info
|
||||||
indicator = { isFanOn }, "Fan off", "Fan on", white, black, green, black
|
indicator = { isFanOn }, "Fan off", "Fan on", white, black, green, black
|
||||||
|
@ -1690,9 +1690,9 @@ gaugeCategory = GPPWM Outputs
|
||||||
indicator = { sd_present }, "No SD card", "SD card present", white, black, green, black
|
indicator = { sd_present }, "No SD card", "SD card present", white, black, green, black
|
||||||
indicator = { sd_logging_internal }, "No SD logging", "SD logging", white, black, green, black
|
indicator = { sd_logging_internal }, "No SD logging", "SD logging", white, black, green, black
|
||||||
indicator = { sd_msd }, "No SD USB", "SD USB", white, black, green, black
|
indicator = { sd_msd }, "No SD USB", "SD USB", white, black, green, black
|
||||||
indicator = { etbRevLimitActive }, "No ETB RPM Limit", "ETB RPM Limit", white, black, yellow, black
|
indicator = { etbRevLimitActive0 }, "No ETB RPM Limit", "ETB RPM Limit", white, black, yellow, black
|
||||||
|
|
||||||
indicator = { wbo0_hasFault }, { WBO0: bitStringValue(wboFaultCodeList, faultCode)}, { WBO0: bitStringValue(wboFaultCodeList, faultCode)}, white, black, red, black
|
indicator = { wbo0_hasFault }, { WBO0: bitStringValue(wboFaultCodeList, faultCode0)}, { WBO0: bitStringValue(wboFaultCodeList, faultCode0)}, white, black, red, black
|
||||||
indicator = {injectorHwIssue}, "inj", "INJ", white, black, red, black@@if_ts_show_inj_diag
|
indicator = {injectorHwIssue}, "inj", "INJ", white, black, red, black@@if_ts_show_inj_diag
|
||||||
|
|
||||||
; indicator = { isInjectionEnabled && fuelCutReason == 0 }, { Inj: bitStringValue(injModeList, currentInjectionMode) }, { Inj: bitStringValue(injModeList, currentInjectionMode) }, white, black, white, black
|
; indicator = { isInjectionEnabled && fuelCutReason == 0 }, { Inj: bitStringValue(injModeList, currentInjectionMode) }, { Inj: bitStringValue(injModeList, currentInjectionMode) }, white, black, white, black
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.rusefi.util;
|
package com.rusefi.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public interface LazyFile extends Output {
|
public interface LazyFile extends Output {
|
||||||
interface LazyFileFactory {
|
interface LazyFileFactory {
|
||||||
LazyFile create(String fileName);
|
LazyFile create(String fileName);
|
||||||
|
|
|
@ -143,9 +143,9 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) {
|
||||||
state.getVariableRegistry().register(structure.getName() + "_size", structure.getTotalSize());
|
state.getVariableRegistry().register(structure.getName() + "_size", structure.getTotalSize());
|
||||||
totalTsSize = tsOutput.run(readerState, structure, 0);
|
totalTsSize = tsOutput.run(readerState, structure, 0, "", "");
|
||||||
|
|
||||||
if (state.isStackEmpty()) {
|
if (state.isStackEmpty()) {
|
||||||
state.getVariableRegistry().register("TOTAL_CONFIG_SIZE", totalTsSize);
|
state.getVariableRegistry().register("TOTAL_CONFIG_SIZE", totalTsSize);
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FragmentDialogConsumerTest {
|
||||||
"\tint8_t autoscale internalMcuTemperature;mcu;\"deg C\",1, 0, 0, 0, 0\n" +
|
"\tint8_t autoscale internalMcuTemperature;mcu;\"deg C\",1, 0, 0, 0, 0\n" +
|
||||||
"end_struct\n";
|
"end_struct\n";
|
||||||
|
|
||||||
FragmentDialogConsumer fragmentDialogConsumer = new FragmentDialogConsumer("ac_state");
|
FragmentDialogConsumer fragmentDialogConsumer = new FragmentDialogConsumer("ac_state", "");
|
||||||
|
|
||||||
state.readBufferedReader(outputChannels, fragmentDialogConsumer);
|
state.readBufferedReader(outputChannels, fragmentDialogConsumer);
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class OutputsTest {
|
||||||
ReaderStateImpl state = new ReaderStateImpl();
|
ReaderStateImpl state = new ReaderStateImpl();
|
||||||
state.getVariableRegistry().register("GAUGE_CATEGORY", "Alternator");
|
state.getVariableRegistry().register("GAUGE_CATEGORY", "Alternator");
|
||||||
DataLogConsumer dataLogConsumer = new DataLogConsumer(null, new TestFileCaptor());
|
DataLogConsumer dataLogConsumer = new DataLogConsumer(null, new TestFileCaptor());
|
||||||
GaugeConsumer gaugeConsumer = new GaugeConsumer(null);
|
GaugeConsumer gaugeConsumer = new GaugeConsumer(null, new TestFileCaptor());
|
||||||
state.readBufferedReader(test, dataLogConsumer, gaugeConsumer);
|
state.readBufferedReader(test, dataLogConsumer, gaugeConsumer);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"entry = alternatorStatus_iTerm, \"alternatorStatus_iTerm\", float, \"%.3f\"\n" +
|
"entry = alternatorStatus_iTerm, \"alternatorStatus_iTerm\", float, \"%.3f\"\n" +
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.yaml.snakeyaml.Yaml;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class LiveDataProcessor {
|
public class LiveDataProcessor {
|
||||||
|
@ -19,15 +20,18 @@ public class LiveDataProcessor {
|
||||||
private final static String enumContentFileName = "console/binary/generated/live_data_ids.h";
|
private final static String enumContentFileName = "console/binary/generated/live_data_ids.h";
|
||||||
|
|
||||||
private final static String tsOutputsDestination = "console/binary/";
|
private final static String tsOutputsDestination = "console/binary/";
|
||||||
|
public static final String GAUGES = tsOutputsDestination + File.separator + "generated/gauges.ini";
|
||||||
public static final String DATA_LOG_FILE_NAME = tsOutputsDestination + File.separator + "generated/data_logs.ini";
|
public static final String DATA_LOG_FILE_NAME = tsOutputsDestination + File.separator + "generated/data_logs.ini";
|
||||||
public static final String OUTPUTS_SECTION_FILE_NAME = tsOutputsDestination + File.separator + "generated/output_channels.ini";
|
public static final String OUTPUTS_SECTION_FILE_NAME = tsOutputsDestination + File.separator + "generated/output_channels.ini";
|
||||||
public static final String DATA_FRAGMENTS_H = "console/binary/generated/live_data_fragments.h";
|
public static final String DATA_FRAGMENTS_H = "console/binary/generated/live_data_fragments.h";
|
||||||
public static final String STATE_DICTIONARY_FACTORY_JAVA = "../java_console/io/src/main/java/com/rusefi/enums/StateDictionaryFactory.java";
|
public static final String STATE_DICTIONARY_FACTORY_JAVA = "../java_console/io/src/main/java/com/rusefi/enums/StateDictionaryFactory.java";
|
||||||
|
public static final String FANCY_CONTENT_INI = "console/binary/generated/fancy_content.ini";
|
||||||
|
public static final String FANCY_MENU_INI = "console/binary/generated/fancy_menu.ini";
|
||||||
|
|
||||||
private final ReaderProvider readerProvider;
|
private final ReaderProvider readerProvider;
|
||||||
private final LazyFile.LazyFileFactory fileFactory;
|
private final LazyFile.LazyFileFactory fileFactory;
|
||||||
|
|
||||||
private final GaugeConsumer gaugeConsumer = new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini");
|
private final GaugeConsumer gaugeConsumer;
|
||||||
|
|
||||||
private final StringBuilder enumContent = new StringBuilder(header +
|
private final StringBuilder enumContent = new StringBuilder(header +
|
||||||
"#pragma once\n" +
|
"#pragma once\n" +
|
||||||
|
@ -52,6 +56,7 @@ public class LiveDataProcessor {
|
||||||
this.readerProvider = readerProvider;
|
this.readerProvider = readerProvider;
|
||||||
this.fileFactory = fileFactory;
|
this.fileFactory = fileFactory;
|
||||||
stateDictionaryGenerator = new StateDictionaryGenerator(yamlFileName);
|
stateDictionaryGenerator = new StateDictionaryGenerator(yamlFileName);
|
||||||
|
gaugeConsumer = new GaugeConsumer(GAUGES, fileFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
@ -65,27 +70,9 @@ public class LiveDataProcessor {
|
||||||
|
|
||||||
|
|
||||||
LiveDataProcessor liveDataProcessor = new LiveDataProcessor(yamlFileName, ReaderProvider.REAL, LazyFile.REAL);
|
LiveDataProcessor liveDataProcessor = new LiveDataProcessor(yamlFileName, ReaderProvider.REAL, LazyFile.REAL);
|
||||||
|
|
||||||
int sensorTsPosition = liveDataProcessor.handleYaml(data);
|
int sensorTsPosition = liveDataProcessor.handleYaml(data);
|
||||||
|
|
||||||
log.info("TS_TOTAL_OUTPUT_SIZE=" + sensorTsPosition);
|
liveDataProcessor.end(sensorTsPosition);
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/total_live_data_generated.h")) {
|
|
||||||
fw.write(header);
|
|
||||||
fw.write("#define TS_TOTAL_OUTPUT_SIZE " + sensorTsPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/sensors.java")) {
|
|
||||||
fw.write(liveDataProcessor.totalSensors.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/fancy_content.ini")) {
|
|
||||||
fw.write(liveDataProcessor.fancyNewStuff.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
try (FileWriter fw = new FileWriter("console/binary/generated/fancy_menu.ini")) {
|
|
||||||
fw.write(liveDataProcessor.fancyNewMenu.toString());
|
|
||||||
}
|
|
||||||
liveDataProcessor.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> getStringObjectMap(Reader reader) {
|
public static Map<String, Object> getStringObjectMap(Reader reader) {
|
||||||
|
@ -100,8 +87,13 @@ public class LiveDataProcessor {
|
||||||
output.write("};\r\n");
|
output.write("};\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void end() throws IOException {
|
private void end(int sensorTsPosition) throws IOException {
|
||||||
gaugeConsumer.endFile();
|
|
||||||
|
log.info("TS_TOTAL_OUTPUT_SIZE=" + sensorTsPosition);
|
||||||
|
try (FileWriter fw = new FileWriter("console/binary/generated/total_live_data_generated.h")) {
|
||||||
|
fw.write(header);
|
||||||
|
fw.write("#define TS_TOTAL_OUTPUT_SIZE " + sensorTsPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EntryHandler {
|
interface EntryHandler {
|
||||||
|
@ -114,7 +106,7 @@ public class LiveDataProcessor {
|
||||||
OutputsSectionConsumer outputsSections = new OutputsSectionConsumer(OUTPUTS_SECTION_FILE_NAME,
|
OutputsSectionConsumer outputsSections = new OutputsSectionConsumer(OUTPUTS_SECTION_FILE_NAME,
|
||||||
fileFactory);
|
fileFactory);
|
||||||
|
|
||||||
ConfigurationConsumer dataLogConsumer = new DataLogConsumer(DATA_LOG_FILE_NAME, fileFactory);
|
DataLogConsumer dataLogConsumer = new DataLogConsumer(DATA_LOG_FILE_NAME, fileFactory);
|
||||||
|
|
||||||
SdCardFieldsContent sdCardFieldsConsumer = new SdCardFieldsContent();
|
SdCardFieldsContent sdCardFieldsConsumer = new SdCardFieldsContent();
|
||||||
|
|
||||||
|
@ -136,12 +128,24 @@ public class LiveDataProcessor {
|
||||||
state.setDefinitionInputFile(folder + File.separator + name + ".txt");
|
state.setDefinitionInputFile(folder + File.separator + name + ".txt");
|
||||||
state.setWithC_Defines(withCDefines);
|
state.setWithC_Defines(withCDefines);
|
||||||
|
|
||||||
|
outputsSections.outputNames = outputNames;
|
||||||
|
dataLogConsumer.outputNames = outputNames;
|
||||||
|
gaugeConsumer.outputNames = outputNames;
|
||||||
|
|
||||||
state.addDestination(javaSensorsConsumer,
|
state.addDestination(javaSensorsConsumer,
|
||||||
outputsSections,
|
outputsSections,
|
||||||
dataLogConsumer
|
dataLogConsumer
|
||||||
);
|
);
|
||||||
FragmentDialogConsumer fragmentDialogConsumer = new FragmentDialogConsumer(name);
|
|
||||||
state.addDestination(fragmentDialogConsumer);
|
List<FragmentDialogConsumer> fragmentConsumers = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < tempLimit(outputNames); i++) {
|
||||||
|
|
||||||
|
String variableNameSuffix = outputNames.length > 1 ? Integer.toString(i) : "";
|
||||||
|
FragmentDialogConsumer fragmentDialogConsumer = new FragmentDialogConsumer(name, variableNameSuffix);
|
||||||
|
fragmentConsumers.add(fragmentDialogConsumer);
|
||||||
|
state.addDestination(fragmentDialogConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
if (extraPrepend != null)
|
if (extraPrepend != null)
|
||||||
state.addPrepend(extraPrepend);
|
state.addPrepend(extraPrepend);
|
||||||
|
@ -179,9 +183,10 @@ public class LiveDataProcessor {
|
||||||
|
|
||||||
state.doJob();
|
state.doJob();
|
||||||
|
|
||||||
fancyNewStuff.append(fragmentDialogConsumer.getContent());
|
for (FragmentDialogConsumer fragmentDialogConsumer : fragmentConsumers) {
|
||||||
|
fancyNewStuff.append(fragmentDialogConsumer.getContent());
|
||||||
fancyNewMenu.append(fragmentDialogConsumer.menuLine());
|
fancyNewMenu.append(fragmentDialogConsumer.menuLine());
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Done with " + name + " at " + javaSensorsConsumer.sensorTsPosition);
|
log.info("Done with " + name + " at " + javaSensorsConsumer.sensorTsPosition);
|
||||||
}
|
}
|
||||||
|
@ -211,10 +216,9 @@ public class LiveDataProcessor {
|
||||||
|
|
||||||
String[] outputNamesArr;
|
String[] outputNamesArr;
|
||||||
if (outputNames == null) {
|
if (outputNames == null) {
|
||||||
outputNamesArr = new String[0];
|
outputNamesArr = new String[]{""};
|
||||||
} else if (outputNames instanceof String) {
|
} else if (outputNames instanceof String) {
|
||||||
outputNamesArr = new String[1];
|
outputNamesArr = new String[]{(String) outputNames};
|
||||||
outputNamesArr[0] = (String) outputNames;
|
|
||||||
} else {
|
} else {
|
||||||
ArrayList<String> nameList = (ArrayList<String>) outputNames;
|
ArrayList<String> nameList = (ArrayList<String>) outputNames;
|
||||||
outputNamesArr = new String[nameList.size()];
|
outputNamesArr = new String[nameList.size()];
|
||||||
|
@ -234,7 +238,7 @@ public class LiveDataProcessor {
|
||||||
.append(">{},\n");
|
.append(">{},\n");
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < outputNamesArr.length; i++) {
|
for (int i = 0; i < outputNamesArr.length; i++) {
|
||||||
if (i != 0) {
|
if (needComment(i)) {
|
||||||
// TODO: remove once the rest of the handling for multiple copies of one struct is in place.
|
// TODO: remove once the rest of the handling for multiple copies of one struct is in place.
|
||||||
fragmentsContent.append("// ");
|
fragmentsContent.append("// ");
|
||||||
}
|
}
|
||||||
|
@ -258,6 +262,17 @@ public class LiveDataProcessor {
|
||||||
|
|
||||||
dataLogConsumer.endFile();
|
dataLogConsumer.endFile();
|
||||||
outputValueConsumer.endFile();
|
outputValueConsumer.endFile();
|
||||||
|
try (LazyFile fw = fileFactory.create("console/binary/generated/sensors.java")) {
|
||||||
|
fw.write(totalSensors.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
try (LazyFile fw = fileFactory.create(FANCY_CONTENT_INI)) {
|
||||||
|
fw.write(fancyNewStuff.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
try (LazyFile fw = fileFactory.create(FANCY_MENU_INI)) {
|
||||||
|
fw.write(fancyNewMenu.toString());
|
||||||
|
}
|
||||||
|
|
||||||
GetConfigValueConsumer.writeStringToFile(STATE_DICTIONARY_FACTORY_JAVA, stateDictionaryGenerator.getCompleteClass(), fileFactory);
|
GetConfigValueConsumer.writeStringToFile(STATE_DICTIONARY_FACTORY_JAVA, stateDictionaryGenerator.getCompleteClass(), fileFactory);
|
||||||
|
|
||||||
|
@ -269,6 +284,7 @@ public class LiveDataProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeFiles() throws IOException {
|
private void writeFiles() throws IOException {
|
||||||
|
gaugeConsumer.endFile();
|
||||||
try (LazyFile fw = fileFactory.create(enumContentFileName)) {
|
try (LazyFile fw = fileFactory.create(enumContentFileName)) {
|
||||||
fw.write(enumContent.toString());
|
fw.write(enumContent.toString());
|
||||||
fw.write(baseAddressCHeader.toString());
|
fw.write(baseAddressCHeader.toString());
|
||||||
|
@ -278,4 +294,12 @@ public class LiveDataProcessor {
|
||||||
fw.write(fragmentsContent.toString());
|
fw.write(fragmentsContent.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int tempLimit(String[] outputs) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean needComment(int index) {
|
||||||
|
return index > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,12 @@ import java.io.IOException;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import static com.rusefi.VariableRegistry.unquote;
|
import static com.rusefi.VariableRegistry.unquote;
|
||||||
|
import static com.rusefi.ldmp.LiveDataProcessor.needComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* here we generate [Datalog] section of TS .ini file
|
* here we generate [Datalog] section of TS .ini file
|
||||||
* DataLog section in turn references [OutputChannels] entities
|
* DataLog section in turn references [OutputChannels] entities
|
||||||
|
*
|
||||||
* @see SdCardFieldsContent
|
* @see SdCardFieldsContent
|
||||||
*/
|
*/
|
||||||
public class DataLogConsumer implements ConfigurationConsumer {
|
public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
|
@ -28,6 +30,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
private final LazyFile.LazyFileFactory fileFactory;
|
private final LazyFile.LazyFileFactory fileFactory;
|
||||||
private final StringBuilder tsWriter = new StringBuilder();
|
private final StringBuilder tsWriter = new StringBuilder();
|
||||||
private final TreeSet<String> comments = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
private final TreeSet<String> comments = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
public String[] outputNames = new String[] {""};
|
||||||
|
|
||||||
public DataLogConsumer(String fileName, LazyFile.LazyFileFactory fileFactory) {
|
public DataLogConsumer(String fileName, LazyFile.LazyFileFactory fileFactory) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
|
@ -37,22 +40,31 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
if (readerState.isStackEmpty()) {
|
if (readerState.isStackEmpty()) {
|
||||||
PerFieldWithStructuresIterator.Strategy strategy = new PerFieldWithStructuresIterator.Strategy() {
|
|
||||||
@Override
|
|
||||||
public String process(ReaderState state, ConfigField configField, String prefix) {
|
|
||||||
return handle(configField, prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
for (int i = 0; i < outputNames.length; i++) {
|
||||||
public boolean skip(ConfigField cf) {
|
String temporaryLineComment = needComment(i) ? ";" : "";
|
||||||
return false;
|
|
||||||
}
|
String variableNameSuffix = outputNames.length > 1 ? Integer.toString(i) : "";
|
||||||
};
|
|
||||||
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
|
|
||||||
strategy);
|
|
||||||
iterator.loop();
|
PerFieldWithStructuresIterator.Strategy strategy = new PerFieldWithStructuresIterator.Strategy() {
|
||||||
String content = iterator.getContent();
|
@Override
|
||||||
tsWriter.append(content);
|
public String process(ReaderState state, ConfigField configField, String prefix) {
|
||||||
|
return handle(configField, prefix, temporaryLineComment, variableNameSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean skip(ConfigField cf) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
|
||||||
|
strategy);
|
||||||
|
iterator.loop();
|
||||||
|
String content = iterator.getContent();
|
||||||
|
tsWriter.append(content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +81,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handle(ConfigField configField, String prefix) {
|
private String handle(ConfigField configField, String prefix, String temporaryLineComment, String variableNameSuffix) {
|
||||||
if (configField.getName().contains(UNUSED))
|
if (configField.getName().contains(UNUSED))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -88,12 +100,12 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
typeString = "int, \"%d\"";
|
typeString = "int, \"%d\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
String comment = getHumanGaugeName(prefix, configField);
|
String comment = getHumanGaugeName(prefix, configField, variableNameSuffix);
|
||||||
|
|
||||||
if (comments.contains(comment))
|
if (comments.contains(comment))
|
||||||
throw new IllegalStateException(comment + " already present in the outputs! " + configField);
|
throw new IllegalStateException(comment + " already present in the outputs! " + configField);
|
||||||
comments.add(comment);
|
comments.add(comment);
|
||||||
return "entry = " + prefix + configField.getName() + ", " + comment + ", " + typeString + "\n";
|
return temporaryLineComment + "entry = " + prefix + configField.getName() + variableNameSuffix + ", " + comment + ", " + typeString + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +113,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
* More detailed technical explanation should be placed in consecutive lines
|
* More detailed technical explanation should be placed in consecutive lines
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getHumanGaugeName(String prefix, ConfigField configField) {
|
public static String getHumanGaugeName(String prefix, ConfigField configField, String variableNameSuffix) {
|
||||||
String comment = configField.getCommentTemplated();
|
String comment = configField.getCommentTemplated();
|
||||||
comment = getFirstLine(comment);
|
comment = getFirstLine(comment);
|
||||||
|
|
||||||
|
@ -111,6 +123,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
*/
|
*/
|
||||||
comment = prefix + unquote(configField.getName());
|
comment = prefix + unquote(configField.getName());
|
||||||
}
|
}
|
||||||
|
comment = comment + variableNameSuffix;
|
||||||
if (comment.length() > MSQ_LENGTH_LIMIT)
|
if (comment.length() > MSQ_LENGTH_LIMIT)
|
||||||
throw new IllegalStateException("[" + comment + "] is too long for log files at " + comment.length());
|
throw new IllegalStateException("[" + comment + "] is too long for log files at " + comment.length());
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
import com.rusefi.ConfigField;
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -14,24 +13,17 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
private final StringBuilder indicatorPanel = new StringBuilder();
|
private final StringBuilder indicatorPanel = new StringBuilder();
|
||||||
private final String fragmentName;
|
private final String fragmentName;
|
||||||
|
private final String variableNameSuffix;
|
||||||
private boolean hasIndicators;
|
private boolean hasIndicators;
|
||||||
private int graphLinesCounter;
|
private int graphLinesCounter;
|
||||||
private int linesInCurrentGraph;
|
private int linesInCurrentGraph;
|
||||||
private int currentGraphIndex;
|
private int currentGraphIndex;
|
||||||
|
|
||||||
public FragmentDialogConsumer(String fragmentName) {
|
public FragmentDialogConsumer(String fragmentName, String variableNameSuffix) {
|
||||||
this.fragmentName = fragmentName;
|
this.fragmentName = fragmentName;
|
||||||
|
this.variableNameSuffix = variableNameSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startFile() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void endFile() throws IOException {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
||||||
|
@ -56,7 +48,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
hasIndicators = true;
|
hasIndicators = true;
|
||||||
indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n");
|
indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n");
|
||||||
}
|
}
|
||||||
indicatorPanel.append("\tindicator = {" + prefix + configField.getName() + "}, " +
|
indicatorPanel.append("\tindicator = {" + prefix + configField.getName() + variableNameSuffix + "}, " +
|
||||||
"\"" + configField.getName() + " No\", " +
|
"\"" + configField.getName() + " No\", " +
|
||||||
"\"" + configField.getName() + " Yes\"" +
|
"\"" + configField.getName() + " Yes\"" +
|
||||||
"\n");
|
"\n");
|
||||||
|
@ -72,7 +64,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
startNewGraph();
|
startNewGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
graphList.append("\t\tgraphLine = " + prefix + configField.getName() + "\n");
|
graphList.append("\t\tgraphLine = " + prefix + configField.getName() + variableNameSuffix + "\n");
|
||||||
linesInCurrentGraph++;
|
linesInCurrentGraph++;
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,13 +84,13 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getPanelName() {
|
private String getPanelName() {
|
||||||
return fragmentName + "IndicatorPanel";
|
return getFragmentNameWithSuffix() + "IndicatorPanel";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String menuLine() {
|
public String menuLine() {
|
||||||
if (getContent().isEmpty())
|
if (getContent().isEmpty())
|
||||||
return "";
|
return "";
|
||||||
return "\t\t\tsubMenu = " + getDialogName() + ", " + quote(fragmentName) + "\n";
|
return "\t\t\tsubMenu = " + getDialogName() + ", " + quote(getFragmentNameWithSuffix()) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
|
@ -107,7 +99,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
String dialogDeclaration = "dialog = " + getDialogName() + ", " + quote(fragmentName) + "\n";
|
String dialogDeclaration = "dialog = " + getDialogName() + ", " + quote(getFragmentNameWithSuffix()) + "\n";
|
||||||
|
|
||||||
String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : "";
|
String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : "";
|
||||||
|
|
||||||
|
@ -122,11 +114,16 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getDialogName() {
|
private String getDialogName() {
|
||||||
return fragmentName + "Dialog";
|
return getFragmentNameWithSuffix() + "Dialog";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getGraphControlName() {
|
private String getGraphControlName() {
|
||||||
return fragmentName + "_" + currentGraphIndex + "_Graph";
|
return getFragmentNameWithSuffix() + "_" + currentGraphIndex + "_Graph";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String getFragmentNameWithSuffix() {
|
||||||
|
return fragmentName + variableNameSuffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,42 +4,51 @@ import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.VariableRegistry;
|
import com.rusefi.VariableRegistry;
|
||||||
|
import com.rusefi.util.LazyFile;
|
||||||
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.rusefi.ldmp.LiveDataProcessor.tempLimit;
|
||||||
import static com.rusefi.output.DataLogConsumer.getHumanGaugeName;
|
import static com.rusefi.output.DataLogConsumer.getHumanGaugeName;
|
||||||
|
|
||||||
public class GaugeConsumer implements ConfigurationConsumer {
|
public class GaugeConsumer implements ConfigurationConsumer {
|
||||||
private final String fileName;
|
private final String fileName;
|
||||||
|
private final LazyFile.LazyFileFactory fileFactory;
|
||||||
private final LinkedHashMap<String, StringBuilder> byCategory = new LinkedHashMap<>();
|
private final LinkedHashMap<String, StringBuilder> byCategory = new LinkedHashMap<>();
|
||||||
|
public String[] outputNames;
|
||||||
|
|
||||||
public GaugeConsumer(String fileName) {
|
public GaugeConsumer(String fileName, LazyFile.LazyFileFactory fileFactory) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
|
this.fileFactory = fileFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
if (readerState.isStackEmpty()) {
|
if (readerState.isStackEmpty()) {
|
||||||
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
|
for (int i = 0; i < tempLimit(outputNames); i++) {
|
||||||
(state, configField, prefix) -> handle(configField, prefix));
|
|
||||||
iterator.loop();
|
String variableNameSuffix = outputNames.length > 1 ? Integer.toString(i) : "";
|
||||||
|
|
||||||
|
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
|
||||||
|
(state, configField, prefix) -> handle(configField, prefix, variableNameSuffix));
|
||||||
|
iterator.loop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endFile() throws IOException {
|
public void endFile() throws IOException {
|
||||||
if (fileName != null) {
|
if (fileName != null) {
|
||||||
FileWriter fw = new FileWriter(fileName);
|
LazyFile fw = fileFactory.create(fileName);
|
||||||
fw.write(getContent());
|
fw.write(getContent());
|
||||||
fw.close();
|
fw.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handle(ConfigField configField, String prefix) {
|
private String handle(ConfigField configField, String prefix, String variableNameSuffix) {
|
||||||
String comment = getHumanGaugeName("", configField);
|
String comment = getHumanGaugeName("", configField, "");
|
||||||
comment = ConfigFieldImpl.unquote(comment);
|
comment = ConfigFieldImpl.unquote(comment);
|
||||||
if (!prefix.isEmpty()) {
|
if (!prefix.isEmpty()) {
|
||||||
comment = prefix + " " + comment;
|
comment = prefix + " " + comment;
|
||||||
|
@ -57,7 +66,7 @@ public class GaugeConsumer implements ConfigurationConsumer {
|
||||||
StringBuilder sb = byCategory.computeIfAbsent(category, s -> new StringBuilder());
|
StringBuilder sb = byCategory.computeIfAbsent(category, s -> new StringBuilder());
|
||||||
|
|
||||||
String fullName = prefix + configField.getName();
|
String fullName = prefix + configField.getName();
|
||||||
String gaugeEntry = fullName + "Gauge = " + fullName + "," + comment +
|
String gaugeEntry = fullName + variableNameSuffix + "Gauge = " + fullName + variableNameSuffix + "," + comment +
|
||||||
", " + VariableRegistry.quote(configField.getUnits()) +
|
", " + VariableRegistry.quote(configField.getUnits()) +
|
||||||
", " + min + "," + max +
|
", " + min + "," + max +
|
||||||
", " + min + "," + max +
|
", " + min + "," + max +
|
||||||
|
|
|
@ -4,10 +4,11 @@ import com.devexperts.logging.Logging;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.util.LazyFile;
|
import com.rusefi.util.LazyFile;
|
||||||
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static com.devexperts.logging.Logging.getLogging;
|
import static com.devexperts.logging.Logging.getLogging;
|
||||||
|
import static com.rusefi.ldmp.LiveDataProcessor.needComment;
|
||||||
|
import static com.rusefi.ldmp.LiveDataProcessor.tempLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: We have to move either forward or backwards with newparse #4441
|
* TODO: We have to move either forward or backwards with newparse #4441
|
||||||
|
@ -19,6 +20,7 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
|
||||||
private final String tsOutputsSectionFileName;
|
private final String tsOutputsSectionFileName;
|
||||||
private final LazyFile.LazyFileFactory fileFactory;
|
private final LazyFile.LazyFileFactory fileFactory;
|
||||||
private final TsOutput tsOutput;
|
private final TsOutput tsOutput;
|
||||||
|
public String[] outputNames = new String[]{""};
|
||||||
private int sensorTsPosition;
|
private int sensorTsPosition;
|
||||||
|
|
||||||
public OutputsSectionConsumer(String tsOutputsSectionFileName, LazyFile.LazyFileFactory fileFactory) {
|
public OutputsSectionConsumer(String tsOutputsSectionFileName, LazyFile.LazyFileFactory fileFactory) {
|
||||||
|
@ -39,13 +41,20 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
log.info("handleEndStruct");
|
log.info("handleEndStruct");
|
||||||
|
|
||||||
sensorTsPosition = tsOutput.run(readerState, structure, sensorTsPosition);
|
for (int i = 0; i < tempLimit(outputNames); i++) {
|
||||||
|
String temporaryLineComment = needComment(i) ? ";" : "";
|
||||||
|
|
||||||
if (readerState.isStackEmpty()) {
|
String variableNameSuffix = outputNames.length > 1 ? Integer.toString(i) : "";
|
||||||
if (tsOutputsSectionFileName != null) {
|
|
||||||
LazyFile fos = fileFactory.create(tsOutputsSectionFileName);
|
|
||||||
fos.write(tsOutput.getContent());
|
sensorTsPosition = tsOutput.run(readerState, structure, sensorTsPosition, temporaryLineComment, variableNameSuffix);
|
||||||
fos.close();
|
|
||||||
|
if (readerState.isStackEmpty()) {
|
||||||
|
if (tsOutputsSectionFileName != null) {
|
||||||
|
LazyFile fos = fileFactory.create(tsOutputsSectionFileName);
|
||||||
|
fos.write(tsOutput.getContent());
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class SdCardFieldsContent {
|
||||||
+ "\t{" +
|
+ "\t{" +
|
||||||
home + (isPtr ? "->" : ".") + name +
|
home + (isPtr ? "->" : ".") + name +
|
||||||
", "
|
", "
|
||||||
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
+ DataLogConsumer.getHumanGaugeName(prefix, configField, "") +
|
||||||
", " +
|
", " +
|
||||||
quote(configField.getUnits()) +
|
quote(configField.getUnits()) +
|
||||||
", " +
|
", " +
|
||||||
|
|
|
@ -39,14 +39,14 @@ public class TsOutput {
|
||||||
return settingContextHelp.toString();
|
return settingContextHelp.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int run(ReaderState state, ConfigStructure structure, int sensorTsPosition) {
|
public int run(ReaderState state, ConfigStructure structure, int sensorTsPosition, String temporaryLineComment, String variableNameSuffix) {
|
||||||
FieldsStrategy strategy = new FieldsStrategy() {
|
FieldsStrategy strategy = new FieldsStrategy() {
|
||||||
@Override
|
@Override
|
||||||
public int writeOneField(FieldIterator it, String prefix, int tsPosition) {
|
public int writeOneField(FieldIterator it, String prefix, int tsPosition) {
|
||||||
ConfigField configField = it.cf;
|
ConfigField configField = it.cf;
|
||||||
ConfigField next = it.next;
|
ConfigField next = it.next;
|
||||||
int bitIndex = it.bitState.get();
|
int bitIndex = it.bitState.get();
|
||||||
String nameWithPrefix = prefix + configField.getName();
|
String nameWithPrefix = prefix + configField.getName() + variableNameSuffix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* in 'Constants' section we have conditional sections and this check is not smart enough to handle those right
|
* in 'Constants' section we have conditional sections and this check is not smart enough to handle those right
|
||||||
|
@ -74,7 +74,7 @@ public class TsOutput {
|
||||||
if (configField.getComment() != null && configField.getComment().trim().length() > 0 && cs == null) {
|
if (configField.getComment() != null && configField.getComment().trim().length() > 0 && cs == null) {
|
||||||
String commentContent = configField.getCommentTemplated();
|
String commentContent = configField.getCommentTemplated();
|
||||||
commentContent = ConfigFieldImpl.unquote(commentContent);
|
commentContent = ConfigFieldImpl.unquote(commentContent);
|
||||||
settingContextHelp.append("\t" + nameWithPrefix + " = " + quote(commentContent) + EOL);
|
settingContextHelp.append(temporaryLineComment + "\t" + nameWithPrefix + " = " + quote(commentContent) + EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cs != null) {
|
if (cs != null) {
|
||||||
|
@ -84,7 +84,7 @@ public class TsOutput {
|
||||||
|
|
||||||
if (configField.isBit()) {
|
if (configField.isBit()) {
|
||||||
if (!configField.getName().startsWith(ConfigStructureImpl.UNUSED_BIT_PREFIX)) {
|
if (!configField.getName().startsWith(ConfigStructureImpl.UNUSED_BIT_PREFIX)) {
|
||||||
tsHeader.append(nameWithPrefix + " = bits, U32,");
|
tsHeader.append(temporaryLineComment + nameWithPrefix + " = bits, U32,");
|
||||||
tsHeader.append(" " + tsPosition + ", [");
|
tsHeader.append(" " + tsPosition + ", [");
|
||||||
tsHeader.append(bitIndex + ":" + bitIndex);
|
tsHeader.append(bitIndex + ":" + bitIndex);
|
||||||
tsHeader.append("]");
|
tsHeader.append("]");
|
||||||
|
@ -111,7 +111,7 @@ public class TsOutput {
|
||||||
if (!configField.getName().equals(next.getName()))
|
if (!configField.getName().equals(next.getName()))
|
||||||
tsPosition += configField.getState().getTsCustomSize().get(configField.getType());
|
tsPosition += configField.getState().getTsCustomSize().get(configField.getType());
|
||||||
} else if (configField.getArraySizes().length == 0) {
|
} else if (configField.getArraySizes().length == 0) {
|
||||||
tsHeader.append(nameWithPrefix + " = scalar, ");
|
tsHeader.append(temporaryLineComment + nameWithPrefix + " = scalar, ");
|
||||||
tsHeader.append(TypesHelper.convertToTs(configField.getType()) + ",");
|
tsHeader.append(TypesHelper.convertToTs(configField.getType()) + ",");
|
||||||
tsHeader.append(" " + tsPosition + ",");
|
tsHeader.append(" " + tsPosition + ",");
|
||||||
tsHeader.append(" " + handleTsInfo(configField, configField.getTsInfo(), 1));
|
tsHeader.append(" " + handleTsInfo(configField, configField.getTsInfo(), 1));
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class LiveDataProcessorTest {
|
||||||
"end_struct");
|
"end_struct");
|
||||||
} else {
|
} else {
|
||||||
return new StringReader("struct_no_prefix wideband_state_s\n" +
|
return new StringReader("struct_no_prefix wideband_state_s\n" +
|
||||||
"\tuint16_t tempC;WBO: Temperature;\"C\", 1, 0, 500, 1000, 0\n" +
|
"\tuint16_t tempC;WBO: Temperature;\"C\", 1, 0, 500, 1000, 0, \"cate\"\n" +
|
||||||
|
"bit bitName\n" +
|
||||||
"\tuint16_t esr;WBO: ESR;\"ohm\", 1, 0, 0, 10000, 0\n" +
|
"\tuint16_t esr;WBO: ESR;\"ohm\", 1, 0, 0, 10000, 0\n" +
|
||||||
"end_struct");
|
"end_struct");
|
||||||
|
|
||||||
|
@ -49,17 +50,22 @@ public class LiveDataProcessorTest {
|
||||||
}
|
}
|
||||||
}, captor);
|
}, captor);
|
||||||
liveDataProcessor.handleYaml(data);
|
liveDataProcessor.handleYaml(data);
|
||||||
assertEquals(10, captor.fileCapture.size());
|
assertEquals(14, captor.fileCapture.size());
|
||||||
|
|
||||||
captor.assertOutput("tempC = scalar, U16, 0, \"C\", 1, 0\n" +
|
captor.assertOutput("tempC0 = scalar, U16, 0, \"C\", 1, 0\n" +
|
||||||
"esr = scalar, U16, 2, \"ohm\", 1, 0\n" +
|
"bitName0 = bits, U32, 4, [0:0]\n" +
|
||||||
"; total TS size = 4\n" +
|
"esr0 = scalar, U16, 8, \"ohm\", 1, 0\n" +
|
||||||
"oootempC = scalar, U16, 4, \"C\", 1, 0\n" +
|
"; total TS size = 12\n" +
|
||||||
"oooesr = scalar, U16, 6, \"ohm\", 1, 0\n" +
|
"oootempC = scalar, U16, 12, \"C\", 1, 0\n" +
|
||||||
"; total TS size = 8\n", LiveDataProcessor.OUTPUTS_SECTION_FILE_NAME);
|
"oooesr = scalar, U16, 14, \"ohm\", 1, 0\n" +
|
||||||
|
"; total TS size = 16\n", LiveDataProcessor.OUTPUTS_SECTION_FILE_NAME);
|
||||||
|
|
||||||
captor.assertOutput("entry = tempC, \"WBO: Temperature\", int, \"%d\"\n" +
|
captor.assertOutput("entry = tempC0, \"WBO: Temperature0\", int, \"%d\"\n" +
|
||||||
"entry = esr, \"WBO: ESR\", int, \"%d\"\n" +
|
"entry = bitName0, \"bitName0\", int, \"%d\"\n" +
|
||||||
|
"entry = esr0, \"WBO: ESR0\", int, \"%d\"\n" +
|
||||||
|
";entry = tempC1, \"WBO: Temperature1\", int, \"%d\"\n" +
|
||||||
|
";entry = bitName1, \"bitName1\", int, \"%d\"\n" +
|
||||||
|
";entry = esr1, \"WBO: ESR1\", int, \"%d\"\n" +
|
||||||
"entry = oootempC, \"Temperature\", int, \"%d\"\n" +
|
"entry = oootempC, \"Temperature\", int, \"%d\"\n" +
|
||||||
"entry = oooesr, \"ESR\", int, \"%d\"\n", LiveDataProcessor.DATA_LOG_FILE_NAME);
|
"entry = oooesr, \"ESR\", int, \"%d\"\n", LiveDataProcessor.DATA_LOG_FILE_NAME);
|
||||||
|
|
||||||
|
@ -68,5 +74,27 @@ public class LiveDataProcessorTest {
|
||||||
"decl_frag<wbo_channels_s, 0>{},\t// wb1\n" +
|
"decl_frag<wbo_channels_s, 0>{},\t// wb1\n" +
|
||||||
"// decl_frag<wbo_channels_s, 1>{},\t// wb2\n" +
|
"// decl_frag<wbo_channels_s, 1>{},\t// wb2\n" +
|
||||||
"decl_frag<output_channels_s>{},\n", LiveDataProcessor.DATA_FRAGMENTS_H);
|
"decl_frag<output_channels_s>{},\n", LiveDataProcessor.DATA_FRAGMENTS_H);
|
||||||
|
|
||||||
|
captor.assertOutput("indicatorPanel = wbo_channels0IndicatorPanel, 2\n" +
|
||||||
|
"\tindicator = {bitName0}, \"bitName No\", \"bitName Yes\"\n" +
|
||||||
|
"\n" +
|
||||||
|
"dialog = wbo_channels0Dialog, \"wbo_channels0\"\n" +
|
||||||
|
"\tpanel = wbo_channels0IndicatorPanel\n" +
|
||||||
|
"\tliveGraph = wbo_channels0_1_Graph, \"Graph\", South\n" +
|
||||||
|
"\t\tgraphLine = tempC0\n" +
|
||||||
|
"\t\tgraphLine = esr0\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"dialog = output_channelsDialog, \"output_channels\"\n" +
|
||||||
|
"\tliveGraph = output_channels_1_Graph, \"Graph\", South\n" +
|
||||||
|
"\t\tgraphLine = oootempC\n" +
|
||||||
|
"\t\tgraphLine = oooesr\n" +
|
||||||
|
"\n", LiveDataProcessor.FANCY_CONTENT_INI);
|
||||||
|
|
||||||
|
captor.assertOutput("\t\t\tsubMenu = wbo_channels0Dialog, \"wbo_channels0\"\n" +
|
||||||
|
"\t\t\tsubMenu = output_channelsDialog, \"output_channels\"\n", LiveDataProcessor.FANCY_MENU_INI);
|
||||||
|
|
||||||
|
captor.assertOutput("\tgaugeCategory = \"cate\"\n" +
|
||||||
|
"tempC0Gauge = tempC0,\"WBO: Temperature\", \"C\", 500.0,1000.0, 500.0,1000.0, 500.0,1000.0, 0,0\n", LiveDataProcessor.GAUGES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class StateDictionaryGeneratorTest {
|
||||||
TestFileCaptor captor = new TestFileCaptor();
|
TestFileCaptor captor = new TestFileCaptor();
|
||||||
LiveDataProcessor liveDataProcessor = new LiveDataProcessor("test", fileName -> new StringReader(""), captor);
|
LiveDataProcessor liveDataProcessor = new LiveDataProcessor("test", fileName -> new StringReader(""), captor);
|
||||||
liveDataProcessor.handleYaml(data);
|
liveDataProcessor.handleYaml(data);
|
||||||
assertEquals("number of outputs", 10, captor.fileCapture.size());
|
assertEquals("number of outputs", 14, captor.fileCapture.size());
|
||||||
|
|
||||||
assertEquals(" stateDictionary.register(live_data_e.LDS_output_channels, TsOutputs.VALUES, \"status_loop\");\n" +
|
assertEquals(" stateDictionary.register(live_data_e.LDS_output_channels, TsOutputs.VALUES, \"status_loop\");\n" +
|
||||||
" stateDictionary.register(live_data_e.LDS_fuel_computer, FuelComputer.VALUES, \"fuel_computer\");\n", liveDataProcessor.stateDictionaryGenerator.content.toString());
|
" stateDictionary.register(live_data_e.LDS_fuel_computer, FuelComputer.VALUES, \"fuel_computer\");\n", liveDataProcessor.stateDictionaryGenerator.content.toString());
|
||||||
|
|
Loading…
Reference in New Issue