Skip to content

Commit

Permalink
Update version and J1939 address in m-ecu crate
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Mar 21, 2024
1 parent 0be8293 commit d184ba2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion m-ecu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "m-ecu"
version = "0.5.2"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
28 changes: 1 addition & 27 deletions m-ecu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const FDCAN_CLOCK: Hertz = Hertz::MHz(32);
const USART_CLOCK: Hertz = Hertz::MHz(48);

/// J1939 network address.
const J1939_ADDRESS: u8 = 0x0;
const J1939_ADDRESS: u8 = 0x12;
/// J1939 name manufacturer code.
///
const J1939_NAME_MANUFACTURER_CODE: u16 = 0x717;
Expand Down Expand Up @@ -387,39 +387,13 @@ mod app {
);

if let Some(rpm) = message.rpm {
// if rpm < 700 {
// ctx.local.pwm0.set_duty(0);
// ctx.local.pwm0.enable();

// ctx.local.pwm1.set_duty(0);
// ctx.local.pwm1.enable();
// } else

let duty = match rpm {
..=1049 => 24_500,
1050..=1549 => 22_500,
1550..=u16::MAX => 20_500,
};

ctx.local.pwm0.set_duty(duty);

// if rpm < 1050 {
// let value = 24_500;

// ctx.local.pwm0.set_duty(value);
// ctx.local.pwm0.enable();

// ctx.local.pwm1.set_duty(0);
// ctx.local.pwm1.enable();
// } else if rpm < 1550 {
// let value = 22_500;

// ctx.local.pwm0.set_duty(value);
// ctx.local.pwm0.enable();

// ctx.local.pwm1.set_duty(0);
// ctx.local.pwm1.enable();
// }
}
}
// PGN::TorqueSpeedControl1 => {
Expand Down

0 comments on commit d184ba2

Please sign in to comment.