Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zencan-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Human-friendly documentation of releases and what's changed in them for the zenc
- Unused code warning when num_tdpos or num_rpdos is 0
- TPDO bug where event flags were never cleared causing all TPDOs to be transmitted when any event
was set
- PDO objects were unwritable when reset_app/reset_comms callback is called

## v0.0.3 - 2026-01-20

Expand Down
18 changes: 12 additions & 6 deletions zencan-node/src/pdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,10 @@ impl SubObjectAccess for PdoCobSubObject<'_> {
}

fn write(&self, data: &[u8]) -> Result<(), AbortCode> {
// Changing PDO config is only allowed during PreOperational state
if self.pdo.nmt_state() != NmtState::PreOperational {
// Changing PDO config is only allowed during PreOperational state, or Bootup when the
// defaults are loaded (Bootup is a always a short-lived state).
let nmt_state = self.pdo.nmt_state();
if nmt_state != NmtState::PreOperational && nmt_state != NmtState::Bootup {
return Err(AbortCode::GeneralError);
}
if data.len() < 4 {
Expand Down Expand Up @@ -549,8 +551,10 @@ impl SubObjectAccess for PdoTransmissionTypeSubObject<'_> {
}

fn write(&self, data: &[u8]) -> Result<(), AbortCode> {
// Changing of PDO config only allowed during preoperational state
if self.pdo.nmt_state() != NmtState::PreOperational {
// Changing PDO config is only allowed during PreOperational state, or Bootup when the
// defaults are loaded (Bootup is a always a short-lived state).
let nmt_state = self.pdo.nmt_state();
if nmt_state != NmtState::PreOperational && nmt_state != NmtState::Bootup {
return Err(AbortCode::GeneralError);
}
if data.is_empty() {
Expand Down Expand Up @@ -657,8 +661,10 @@ impl ObjectAccess for PdoMappingObject<'_> {
}

fn write(&self, sub: u8, data: &[u8]) -> Result<(), AbortCode> {
// Changing of PDO mapping is only allowed in PreOperational state
if self.pdo.nmt_state() != NmtState::PreOperational {
// Changing PDO config is only allowed during PreOperational state, or Bootup when the
// defaults are loaded (Bootup is a always a short-lived state).
let nmt_state = self.pdo.nmt_state();
if nmt_state != NmtState::PreOperational && nmt_state != NmtState::Bootup {
return Err(AbortCode::GeneralError);
}
if sub == 0 {
Expand Down