We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
A minimal dbc-file:
VERSION "A version string" BA_ "SingleFrame" BO_ 2364539904 0; BO_ 643 Message: 8 Vector__XXX SG_ Signal : 32|16@1- (1,0) [0|0] "" Vector__XXX
Rust code:
extern crate canparse; // use std::env; use canparse::pgn::{PgnLibrary, SpnDefinition, ParseMessage}; fn main() { let dbc_filename = "test.dbc"; let msg_name = "Signal"; // Parse dbc file into PgnLibrary let lib = PgnLibrary::from_dbc_file(dbc_filename).unwrap(); // Pull signal definition for engine speed let enginespeed_def: &SpnDefinition = lib .get_spn(msg_name).unwrap(); // Parse frame containing engine speed let msg: [u8; 8] = [0x00, 0x01, 0x00, 0x00, 0xcb, 0xff, 0x02, 0x00]; let engine_speed = enginespeed_def.parse_message(&msg).unwrap(); println!("Engine speed: {}", engine_speed); }
Output:
Engine speed: 65483
But the correct value should be 65483 - 2**16=-53, which cantools correctly decodes.
65483 - 2**16=-53
The text was updated successfully, but these errors were encountered:
Ugh, thanks. I should really write more unit tests 🤦
Sorry, something went wrong.
No branches or pull requests
A minimal dbc-file:
Rust code:
Output:
But the correct value should be
65483 - 2**16=-53
, which cantools correctly decodes.The text was updated successfully, but these errors were encountered: