Skip to content

Commit

Permalink
Update hcu version to 0.5.3 and fix PDU_NOT_AVAILABLE usage
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Feb 2, 2024
1 parent 0bb947b commit 6d37be1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions 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 hcu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hcu"
version = "0.5.2"
version = "0.5.3"
edition = "2021"

[dependencies]
Expand Down
26 changes: 13 additions & 13 deletions hcu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mod app {
use stm32h7xx_hal::system_watchdog::{Event::EarlyWakeup, SystemWindowWatchdog};

use vecraft::fdcan;
use vecraft::j1939::{protocol, FrameBuilder, IdBuilder, NameBuilder, PGN};
use vecraft::j1939::{protocol, FrameBuilder, IdBuilder, NameBuilder, PDU_NOT_AVAILABLE, PGN};
use vecraft::Systick;

/// 100 Hz / 10 ms granularity
Expand Down Expand Up @@ -335,7 +335,7 @@ mod app {
state.as_byte(),
state_subclass,
is_locked as u8,
0xff,
PDU_NOT_AVAILABLE,
timestamp.to_le_bytes()[0],
timestamp.to_le_bytes()[1],
timestamp.to_le_bytes()[2],
Expand Down Expand Up @@ -409,9 +409,9 @@ mod app {
crate::PKG_VERSION_MINOR.parse::<u8>().unwrap(),
crate::PKG_VERSION_PATCH.parse::<u8>().unwrap(),
b'*',
0xff,
0xff,
0xff,
PDU_NOT_AVAILABLE,
PDU_NOT_AVAILABLE,
PDU_NOT_AVAILABLE,
])
.build();

Expand Down Expand Up @@ -485,31 +485,31 @@ mod app {
}
}
PGN::Other(40_960) => {
if frame.pdu()[0..2] != [0xff, 0xff] {
if frame.pdu()[0..2] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[0..2].try_into().unwrap());

ctx.local
.gate_control
.gate0
.set_value(valve_value(gate_value));
}
if frame.pdu()[2..4] != [0xff, 0xff] {
if frame.pdu()[2..4] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[2..4].try_into().unwrap());

ctx.local
.gate_control
.gate1
.set_value(valve_value32(gate_value));
}
if frame.pdu()[4..6] != [0xff, 0xff] {
if frame.pdu()[4..6] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[4..6].try_into().unwrap());

ctx.local
.gate_control
.gate2
.set_value(valve_value32(gate_value));
}
if frame.pdu()[6..8] != [0xff, 0xff] {
if frame.pdu()[6..8] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[6..8].try_into().unwrap());

ctx.local
Expand All @@ -519,31 +519,31 @@ mod app {
}
}
PGN::Other(41_216) => {
if frame.pdu()[0..2] != [0xff, 0xff] {
if frame.pdu()[0..2] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[0..2].try_into().unwrap());

ctx.local
.gate_control
.gate4
.set_value(valve_value(gate_value));
}
if frame.pdu()[2..4] != [0xff, 0xff] {
if frame.pdu()[2..4] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[2..4].try_into().unwrap());

ctx.local
.gate_control
.gate5
.set_value(valve_value(gate_value));
}
if frame.pdu()[4..6] != [0xff, 0xff] {
if frame.pdu()[4..6] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[4..6].try_into().unwrap());

ctx.local
.gate_control
.gate6
.set_value(valve_value(gate_value));
}
if frame.pdu()[6..8] != [0xff, 0xff] {
if frame.pdu()[6..8] != [PDU_NOT_AVAILABLE, PDU_NOT_AVAILABLE] {
let gate_value = i16::from_le_bytes(frame.pdu()[6..8].try_into().unwrap());

ctx.local
Expand Down
1 change: 0 additions & 1 deletion vecraft/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// #![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
Expand Down

0 comments on commit 6d37be1

Please sign in to comment.