Skip to content

Commit

Permalink
Add more error messages and correct the segmented sdo message
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Petersen committed Nov 12, 2021
1 parent f0a1cda commit 610a46a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sdo/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,32 @@ func (upload Upload) Do(bus *can.Bus) ([]byte, error) {
Actual: hasBit(resp.Frame.Data[0], 4),
}

} else if scs := resp.Frame.Data[0] >> 5; scs != 0 {
} /*else if scs := resp.Frame.Data[0] >> 5; scs != 0 {
return nil, canopen.UnexpectedSCSResponse{
Expected: 0,
Actual: scs,
}
}
}*/

n := (resp.Frame.Data[0] >> 1) & 0x7
buf.Write(resp.Frame.Data[1 : 8-n])

// Check if we have received too many bytes
if buf.Len() > int(total) {
/*if buf.Len() > int(total) {
return nil, canopen.UnexpectedResponseLength{
Expected: int(total),
Actual: buf.Len(),
}
}
}*/

if hasBit(resp.Frame.Data[0], 0) { // c = 1?
// Check if we have received too few bytes
/*// Check if we have received too few bytes
if buf.Len() != int(total) {
return nil, canopen.UnexpectedResponseLength{
Expected: int(total),
Actual: buf.Len(),
}
}
}*/
break
}
}
Expand Down

0 comments on commit 610a46a

Please sign in to comment.