technocreatives / dbc-codegen

Generate Rust structs for messages from a dbc (CAN bus definition) file.
Apache License 2.0
43 stars 23 forks source link

Add check for range of value parameter when setting signal #5

Closed marcelbuesing closed 3 years ago

marcelbuesing commented 3 years ago

Add a feature that asserts that values are within the min/max range defined in the DBC.

killercup commented 3 years ago

Very nice!

Any specific reason to go for assert and not return a new variant of CanError?

marcelbuesing commented 3 years ago

Good question. I think that would make more sense. I'll change that. Nobody likes unexpected panics at runtime =).

killercup commented 3 years ago

Especially not on embedded :)

Thanks!

On Tue, 23 Feb 2021, 12:28 Marcel, notifications@github.com wrote:

Good question. I think that would make more sense. I'll change that. Nobody likes unexpected panics at runtime =).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/technocreatives/dbc-codegen/pull/5#issuecomment-784133885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAE4X6ZTPV4WV46Z7AYZVTTAOGMXANCNFSM4YB653BA .

marcelbuesing commented 3 years ago

Fixed it. I think it would have been great to include the actual value in the returned Error but that seems hard given the different types.