VVT pid into logs

only:proteus_f4
This commit is contained in:
rusefillc 2023-10-07 11:52:35 -04:00
parent a85cebf2cc
commit 0df3dbb06b
2 changed files with 18 additions and 3 deletions

View File

@ -65,15 +65,19 @@ public class OutputsTest {
"\t\tfloat pTerm;;\"\", 1, 0, -50000, 50000, 2\n" +
"\t\tint16_t autoscale dTerm;;\"\", 0.01, 0, -327, 327, 2\n" +
"\tend_struct\n" +
"\tpid_status_s[2 iterate] vvtStatus\n" +
"\tpid_status_s wastegateDcStatus\n" +
"\n" +
"\tpid_status_s[2 iterate] vvtStatus\n" +
"end_struct\n";
ReaderStateImpl state = new ReaderStateImpl();
DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
state.readBufferedReader(test, dataLogConsumer);
assertEquals(
"entry = wastegateDcStatus_pTerm, \"wastegateDcStatus_pTerm\", float, \"%.3f\"\n" +
"entry = vvtStatus1_pTerm, \"vvtStatus1_pTerm\", float, \"%.3f\"\n" +
"entry = vvtStatus1_dTerm, \"vvtStatus1_dTerm\", float, \"%.3f\"\n" +
"entry = vvtStatus2_pTerm, \"vvtStatus2_pTerm\", float, \"%.3f\"\n" +
"entry = vvtStatus2_dTerm, \"vvtStatus2_dTerm\", float, \"%.3f\"\n" +
"entry = wastegateDcStatus_pTerm, \"wastegateDcStatus_pTerm\", float, \"%.3f\"\n" +
"entry = wastegateDcStatus_dTerm, \"wastegateDcStatus_dTerm\", float, \"%.3f\"\n",
dataLogConsumer.getContent());
}

View File

@ -35,8 +35,19 @@ public class DataLogConsumer implements ConfigurationConsumer {
@Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
if (readerState.isStackEmpty()) {
PerFieldWithStructuresIterator.Strategy strategy = new PerFieldWithStructuresIterator.Strategy() {
@Override
public String process(ReaderState state, ConfigField configField, String prefix) {
return handle(configField, prefix);
}
@Override
public boolean skip(ConfigField cf) {
return false;
}
};
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
(configField, prefix, prefix2) -> handle(prefix, prefix2));
strategy);
iterator.loop();
String content = iterator.getContent();
tsWriter.append(content);