SD logging: generate code conditionally
This commit is contained in:
parent
632912d265
commit
2111d13df5
|
@ -128,6 +128,7 @@ public class LiveDataProcessor {
|
|||
|
||||
if (constexpr != null) {
|
||||
sdCardFieldsConsumer.home = constexpr;
|
||||
sdCardFieldsConsumer.conditional = conditional;
|
||||
state.addDestination((state1, structure) -> sdCardFieldsConsumer.handleEndStruct(state1, structure));
|
||||
|
||||
outputValueConsumer.currentSectionPrefix = constexpr;
|
||||
|
|
|
@ -11,6 +11,7 @@ public class SdCardFieldsContent {
|
|||
private final StringBuilder body = new StringBuilder();
|
||||
|
||||
public String home = "engine->outputChannels";
|
||||
public String conditional;
|
||||
|
||||
public void handleEndStruct(ReaderState state, ConfigStructure structure) throws IOException {
|
||||
if (state.isStackEmpty()) {
|
||||
|
@ -47,7 +48,11 @@ public class SdCardFieldsContent {
|
|||
categoryStr = ", " + categoryStr;
|
||||
}
|
||||
|
||||
return "\t{" + home + "." + name +
|
||||
String before = conditional == null ? "" : "#if " + conditional + "\n";
|
||||
String after = conditional == null ? "" : "#endif\n";
|
||||
|
||||
return before
|
||||
+ "\t{" + home + "." + name +
|
||||
", "
|
||||
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
||||
", " +
|
||||
|
@ -55,7 +60,8 @@ public class SdCardFieldsContent {
|
|||
", " +
|
||||
configField.getDigits() +
|
||||
categoryStr +
|
||||
"},\n";
|
||||
"},\n" +
|
||||
after;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
|
|
Loading…
Reference in New Issue