parent
00b3372929
commit
8f0eb676a5
|
@ -74,7 +74,7 @@ public class TsOutput {
|
|||
if (configField.getState().tsCustomLine.containsKey(configField.getType())) {
|
||||
String bits = configField.getState().tsCustomLine.get(configField.getType());
|
||||
if (!bits.startsWith("bits")) {
|
||||
bits = handleTsInfo(bits, 5);
|
||||
bits = handleTsInfo(configField, bits, 5);
|
||||
}
|
||||
|
||||
bits = bits.replaceAll("@OFFSET@", "" + tsPosition);
|
||||
|
@ -86,7 +86,7 @@ public class TsOutput {
|
|||
tsHeader.append(nameWithPrefix + " = scalar, ");
|
||||
tsHeader.append(TypesHelper.convertToTs(configField.getType()) + ",");
|
||||
tsHeader.append(" " + tsPosition + ",");
|
||||
tsHeader.append(" " + handleTsInfo(configField.getTsInfo(), 1));
|
||||
tsHeader.append(" " + handleTsInfo(configField, configField.getTsInfo(), 1));
|
||||
if (!configField.getName().equals(next.getName()))
|
||||
tsPosition += configField.getSize(next);
|
||||
} else if (configField.getSize(next) == 0) {
|
||||
|
@ -106,7 +106,7 @@ public class TsOutput {
|
|||
}
|
||||
tsHeader.append(size);
|
||||
}
|
||||
tsHeader.append("], " + handleTsInfo(configField.getTsInfo(), 1));
|
||||
tsHeader.append("], " + handleTsInfo(configField, configField.getTsInfo(), 1));
|
||||
|
||||
if (!configField.getName().equals(next.getName()))
|
||||
tsPosition += configField.getSize(next);
|
||||
|
@ -123,8 +123,8 @@ public class TsOutput {
|
|||
return sensorTsPosition;
|
||||
}
|
||||
|
||||
private String handleTsInfo(String tsInfo, int multiplierIndex) {
|
||||
if (tsInfo == null) {
|
||||
private String handleTsInfo(ConfigField configField, String tsInfo, int multiplierIndex) {
|
||||
if (tsInfo == null || tsInfo.trim().isEmpty()) {
|
||||
if (isConstantsSection) {
|
||||
throw new IllegalStateException("todo: implement default tsInfo for long form");
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class TsOutput {
|
|||
}
|
||||
return sb.toString();
|
||||
} catch (Throwable e) {
|
||||
throw new IllegalStateException("While parsing " + tsInfo, e);
|
||||
throw new IllegalStateException("While parsing [" + tsInfo + "] of " + configField, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class OutputsTest {
|
|||
"bit isForcedInduction;Does the vehicle have a turbo or supercharger?\n" +
|
||||
"bit enableFan1WithAc;+Turn on this fan when AC is on.\n" +
|
||||
"angle_t m_requested_pump;Computed requested pump duration in degrees (not including deadtime)\n" +
|
||||
"float tCharge;speed density\\nRate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.;\n" +
|
||||
"end_struct\n";
|
||||
ReaderState state = new ReaderState();
|
||||
|
||||
|
@ -61,7 +62,8 @@ public class OutputsTest {
|
|||
"unusedBit_4_31 = bits, U32, 5, [31:31]\n" +
|
||||
"alignmentFill_at_9 = array, U08, 9, [3], \"units\", 1, 0\n" +
|
||||
"m_requested_pump = scalar, F32, 12, \"\", 1, 0\n" +
|
||||
"; total TS size = 16\n", tsProjectConsumer.getContent());
|
||||
"tCharge = scalar, F32, 16, \"\", 1, 0\n" +
|
||||
"; total TS size = 20\n", tsProjectConsumer.getContent());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue