Skip to content

Commit

Permalink
Fix submodule? (#90)
Browse files Browse the repository at this point in the history
* Fix submodule?

* formatting and clippy

---------

Co-authored-by: harry <[email protected]>
  • Loading branch information
jr1221 and harrison-e authored Dec 23, 2024
1 parent e4e1199 commit e987b3c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Embedded-Base
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 9 additions & 6 deletions libs/calypso-cangen/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec<CANSpecError>> {
// 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(),
Expand All @@ -142,10 +144,7 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec<CANSpecError>> {
}
}

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;
Expand Down Expand Up @@ -181,7 +180,11 @@ fn validate_msg(_msg: CANMsg) -> Result<(), Vec<CANSpecError>> {
));
}
// 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(),
Expand Down

0 comments on commit e987b3c

Please sign in to comment.