Add optional defmt::Format support for generated types. #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for the low resource defmt logging system.
CAN messages are formatted by printing the fields, for example:
Vcu200(Vcu200 { RangeAdditionalClimateOff=0 CurrentGear=P RangeLSB=false Range=194 AccelPedal_Pos2=0 UnkStatus=0 Counter=0 AccelPedalPos3=0 })
.This is different to the current
Debug
support which just logs the enum name and the raw bytes, for example:Vcu200(Vcu200([0, 0, 97, 0, 0, 0, 208, 0]))
.My feeling is that it's always straightforward to log
msg.id(), msg.raw()
from the code, so having the structured formatting is useful.defmt
overhead is much less thanDebug
. In my embedded project which has 107 DBC Messages defined, usingdefmt
to log an arbitrary Messages instance adds about 22KB of binary size. UsingDebug
(viaDebug2Format
) instead adds 85KB of binary size(!), despite the Debug output being less structured!! (Although to be fair most of this overhead is the one-off cost of including Debug formatting support.)