From c1a901a9a0a5e38fde6323cdacf4901dc0ae6373 Mon Sep 17 00:00:00 2001 From: harry Date: Sat, 21 Dec 2024 16:29:07 -0500 Subject: [PATCH 1/2] Fix submodule? --- .gitmodules | 2 +- Embedded-Base | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8193e62..d273484 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "Embedded-Base"] path = Embedded-Base - url = https://github.com/Northeastern-Electric-Racing/Embedded-Base.git + url = https://github.com/Northeastern-Electric-Racing/Embedded-Base.git branch = main diff --git a/Embedded-Base b/Embedded-Base index c2061ae..96746ba 160000 --- a/Embedded-Base +++ b/Embedded-Base @@ -1 +1 @@ -Subproject commit c2061ae62cf670cdb6fb6ac9c966f3ec74ffc916 +Subproject commit 96746ba444ce958ecd38986cd95b5e8d0a9d1c6c From 73cacf0398bb23b67de9eed0fa758d23e8b93b25 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Mon, 23 Dec 2024 12:02:08 -0500 Subject: [PATCH 2/2] formatting and clippy --- build.rs | 2 +- libs/calypso-cangen/src/validate.rs | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 7ce53c1..68b482c 100644 --- a/build.rs +++ b/build.rs @@ -21,7 +21,7 @@ fn main() { Ok(()) => {} Err(errors) => { for error in errors { - // The \x1b[...m is an ANSI escape sequence for colored terminal output + // The \x1b[...m is an ANSI escape sequence for colored terminal output println!("\x1b[31;1mCAN spec error:\x1b[0m {}", error); } process::exit(1); diff --git a/libs/calypso-cangen/src/validate.rs b/libs/calypso-cangen/src/validate.rs index b0fcee2..e12e437 100644 --- a/libs/calypso-cangen/src/validate.rs +++ b/libs/calypso-cangen/src/validate.rs @@ -133,7 +133,9 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec> { // Check Sim enum frequencies add to 1 (roughly, f32s are approximate) if let Some(Sim::SimEnum { options }) = _field.sim { let mut _sim_total: f32 = 0.0; - options.iter().for_each(|opt| { _sim_total += opt[1]; }); + options.iter().for_each(|opt| { + _sim_total += opt[1]; + }); if (_sim_total - 1.0).abs() > 0.00001 { _errors.push(CANSpecError::FieldSimEnumFrequencySum( _name.clone(), @@ -142,10 +144,7 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec> { } } - let _send = match _field.send { - Some(false) => false, - _ => true - }; + let _send = !matches!(_field.send, Some(false)); for (_i, _point) in _field.points.iter().enumerate() { _bit_count += _point.size; @@ -181,7 +180,11 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec> { )); } // Check little endian point bit count - else if s == "little" && _point.size != 8 && _point.size != 16 && _point.size != 32 { + else if s == "little" + && _point.size != 8 + && _point.size != 16 + && _point.size != 32 + { _errors.push(CANSpecError::PointLittleEndianBitCount( _i, _name.clone(),