2 byte pin index #4097
Matt by the way we do support '#if' in code generation but for now without alignment any longer
This commit is contained in:
parent
34b15e2e0c
commit
10409ebd59
|
@ -26,9 +26,9 @@ public class TSProjectConsumerTest {
|
|||
String test = "struct pid_s\n" +
|
||||
"custom afr_table_t 4x4 array, U08, @OFFSET@, [4x4],\"deg\",\t {1/10}, 0, 0, 25.0, 1 \n" +
|
||||
"#if LAMBDA\n" +
|
||||
"\tint16_t periodMs2;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
|
||||
"\tint periodMs2;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
|
||||
"#else\n" +
|
||||
"\tint16_t periodMs2;PID dTime;\"ms2\", 1, 0, 0, 3000, 0\n" +
|
||||
"\tint periodMs2;PID dTime;\"ms2\", 1, 0, 0, 3000, 0\n" +
|
||||
"#endif\n" +
|
||||
"#if LAMBDA\n" +
|
||||
"afr_table_t afrTable;\t\t\n" +
|
||||
|
@ -49,21 +49,23 @@ public class TSProjectConsumerTest {
|
|||
state.readBufferedReader(test, javaFieldsConsumer, consumer, tsProjectConsumer);
|
||||
|
||||
assertEquals("#if LAMBDA\n" +
|
||||
"periodMs2 = scalar, S16, 0, \"ms\", 1, 0, 0, 3000, 0\n" +
|
||||
"periodMs2 = scalar, S32, 0, \"ms\", 1, 0, 0, 3000, 0\n" +
|
||||
"#else\n" +
|
||||
"periodMs2 = scalar, S16, 0, \"ms2\", 1, 0, 0, 3000, 0\n" +
|
||||
"periodMs2 = scalar, S32, 0, \"ms2\", 1, 0, 0, 3000, 0\n" +
|
||||
"#endif\n" +
|
||||
"#if LAMBDA\n" +
|
||||
"afrTable = array, U08, 2, [4x4],\"deg\", 0.1, 0, 0, 25.0, 1\n" +
|
||||
"afrTable = array, U08, 4, [4x4],\"deg\", 0.1, 0, 0, 25.0, 1\n" +
|
||||
"#else\n" +
|
||||
"afrTable = array, U08, 2, [4x4],\"deg\", 0.1, 0, 0, 25.0, 1\n" +
|
||||
"afrTable = array, U08, 4, [4x4],\"deg\", 0.1, 0, 0, 25.0, 1\n" +
|
||||
"#endif\n" +
|
||||
"periodMs = scalar, S16, 18, \"ms\", 0.1, 0, 0, 3000, 0\n" +
|
||||
"; total TS size = 20\n", tsProjectConsumer.getContent());
|
||||
"periodMs = scalar, S16, 20, \"ms\", 0.1, 0, 0, 3000, 0\n" +
|
||||
"alignmentFill_at_22 = array, U08, 22, [2], \"units\", 1, 0, -20, 100, 0\n" +
|
||||
"; total TS size = 24\n", tsProjectConsumer.getContent());
|
||||
|
||||
assertEquals("\tpublic static final Field PERIODMS2 = Field.create(\"PERIODMS2\", 0, FieldType.INT16).setScale(1.0);\n" +
|
||||
"\tpublic static final Field AFRTABLE = Field.create(\"AFRTABLE\", 2, FieldType.INT).setScale(1.0);\n" +
|
||||
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 18, FieldType.INT16).setScale(1.0);\n",
|
||||
assertEquals("\tpublic static final Field PERIODMS2 = Field.create(\"PERIODMS2\", 0, FieldType.INT).setScale(1.0);\n" +
|
||||
"\tpublic static final Field AFRTABLE = Field.create(\"AFRTABLE\", 4, FieldType.INT).setScale(1.0);\n" +
|
||||
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 20, FieldType.INT16).setScale(1.0);\n" +
|
||||
"\tpublic static final Field ALIGNMENTFILL_AT_22 = Field.create(\"ALIGNMENTFILL_AT_22\", 22, FieldType.INT8).setScale(1.0);\n",
|
||||
javaFieldsConsumer.getContent());
|
||||
|
||||
|
||||
|
@ -74,19 +76,25 @@ public class TSProjectConsumerTest {
|
|||
"\tms\n" +
|
||||
"\t * offset 0\n" +
|
||||
"\t */\n" +
|
||||
"\tint16_t periodMs2 = (int16_t)0;\n" +
|
||||
"\tint periodMs2 = (int)0;\n" +
|
||||
"\t/**\n" +
|
||||
"\t * offset 2\n" +
|
||||
"\t * offset 4\n" +
|
||||
"\t */\n" +
|
||||
"\tafr_table_t afrTable;\n" +
|
||||
"\t/**\n" +
|
||||
"\t * PID dTime\n" +
|
||||
"\tms\n" +
|
||||
"\t * offset 18\n" +
|
||||
"\t * offset 20\n" +
|
||||
"\t */\n" +
|
||||
"\tint16_t periodMs = (int16_t)0;\n" +
|
||||
"\t/**\n" +
|
||||
"\t * need 4 byte alignment\n" +
|
||||
"\tunits\n" +
|
||||
"\t * offset 22\n" +
|
||||
"\t */\n" +
|
||||
"\tuint8_t alignmentFill_at_22[2];\n" +
|
||||
"};\n" +
|
||||
"static_assert(sizeof(pid_s) == 20);\n" +
|
||||
"static_assert(sizeof(pid_s) == 24);\n" +
|
||||
"\n", consumer.getContent());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue