From d5126a6c346f06b1090540cac69869f192df84aa Mon Sep 17 00:00:00 2001 From: Paul Zinselmeyer Date: Fri, 3 May 2024 17:42:40 +0200 Subject: [PATCH] fix parsing errors in sml --- canome/src/power.rs | 2 +- sml_parser/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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,