only:cast enum to int for data logging
This commit is contained in:
parent
4fff20bcbf
commit
4309e5f759
|
@ -74,6 +74,19 @@ public class SdCardFieldsGeneratorTest {
|
|||
}, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enumField() {
|
||||
processAndAssert("struct_no_prefix output_channels_s\n" +
|
||||
" custom idle_state_e 4 bits, S32, @OFFSET@, [0:2], \"not important\"\n" +
|
||||
" idle_state_e idleState\n" +
|
||||
"end_struct",
|
||||
"",
|
||||
readerState -> {
|
||||
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
interface Actor {
|
||||
void act(ReaderStateImpl readerState);
|
||||
}
|
||||
|
|
|
@ -50,17 +50,22 @@ public class SdCardFieldsContent {
|
|||
private String getLine(ConfigField configField, String prefix, String name) {
|
||||
String categoryStr = configField.getCategory();
|
||||
|
||||
if(categoryStr == null) {
|
||||
if (categoryStr == null) {
|
||||
categoryStr = "";
|
||||
} else {
|
||||
categoryStr = ", " + categoryStr;
|
||||
}
|
||||
|
||||
boolean isEnum = configField.getType().contains("_e");
|
||||
if (isEnum)
|
||||
return "";
|
||||
|
||||
String before = conditional == null ? "" : "#if " + conditional + "\n";
|
||||
String after = conditional == null ? "" : "#endif\n";
|
||||
|
||||
return before
|
||||
+ "\t{" + home + (isPtr ? "->" : ".") + name +
|
||||
+ "\t{" +
|
||||
home + (isPtr ? "->" : ".") + name +
|
||||
", "
|
||||
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
||||
", " +
|
||||
|
|
Loading…
Reference in New Issue