diff --git a/canome/src/power.rs b/canome/src/power.rs index 0c67dd5..554824b 100644 --- a/canome/src/power.rs +++ b/canome/src/power.rs @@ -33,7 +33,7 @@ mod can { } let total = u32::from_be_bytes([data[0], data[1], data[2], data[3]]); - let current = u32::from_be_bytes([data[4], data[4], data[5], data[6]]); + let current = u32::from_be_bytes([data[4], data[5], data[6], data[7]]); Ok(Self { total, current }) } diff --git a/sml_parser/src/lib.rs b/sml_parser/src/lib.rs index ab62fed..3763523 100644 --- a/sml_parser/src/lib.rs +++ b/sml_parser/src/lib.rs @@ -571,7 +571,7 @@ impl<'a> SmlType<'a> for AbortOnError { where Self: Sized, { - let disc: u8 = buf.read(1)?[0]; + let disc: u8 = buf.parse()?; Ok(match disc { 0x00 => Self::Continue, 0x01 => Self::ContinueWithNextGroup,