Open aangert opened 6 months ago
Using the uint values from the CDDL is an optimization that is applied sometimes. Right now, it's only applied in the trivial cases, where a union contains only unambiguous integers. In your example, the AllUnits union contains an integer and another union.
Thanks for the report, I will track it as a possible improvement.
When generating code the indicated value in complex enums is ignored. In the example
UNIT_UNDEFINED
should be of value 1, but this is missing from the generated code, causing it to have a value of 0. The error occurs regardless of the number and value of items inAllUnits
.This issue might be an extension of https://github.com/NordicSemiconductor/zcbor/issues/14
CDDL: