Skip to content

Commit

Permalink
ok my bad this should be it
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfbastos committed Feb 1, 2025
1 parent 32279f1 commit bf3f270
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/io/hyped_can/hyped_can_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ fn impl_hyped_can(ast: &syn::DeriveInput) -> TokenStream {
}

fn write_frame(&mut self, frame: &HypedCanFrame) -> Result<(), CanError> {
match frame.can_id {
id if id <= 0x7FF => Id::Standard(StandardId::new(id as u16).unwrap()),
id => Id::Extended(ExtendedId::new(id).unwrap()),
let id = if frame.can_id <= 0x7FF {
Id::Standard(StandardId::new(frame.can_id as u16).unwrap())
} else {
Id::Extended(ExtendedId::new(frame.can_id).unwrap())
};


let frame_header = frame::Header::new(id, frame.data.len() as u8, false);

let frame = Frame::new(frame_header, &frame.data);
Expand Down

0 comments on commit bf3f270

Please sign in to comment.