Skip to content

Commit

Permalink
SDO datalength should be the bytes that does NOT contain data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Petersen committed Oct 5, 2021
1 parent b2b6e0f commit 8c9d130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
github.com/FabianPetersen/can v0.0.3 h1:AvNdtYRx/Qqd9ecVmPPk4/U27GT5kyvurtriWyASoMU=
github.com/FabianPetersen/can v0.0.3/go.mod h1:K+0T7NSTiAhcH/zIYFPj4o256RKIwQ1Y/uHTC9MyK4I=
github.com/brutella/can v0.0.1 h1:Rz+2Zuje3NT79daon8wPN9+VphH3/kl1DP8Dhf/k1NI=
github.com/brutella/can v0.0.1/go.mod h1:NYDxbQito3w4+4DcjWs/fpQ3xyaFdpXw/KYqtZFU98k=
golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06 h1:0oC8rFnE+74kEmuHZ46F6KHsMr5Gx2gUQPuNz28iQZM=
golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872 h1:cGjJzUd8RgBw428LXP65YXni0aiGNA4Bl+ls8SmLOm8=
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3 changes: 2 additions & 1 deletion sdo/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ func (download Download) Do(bus *can.Bus) error {
n = byte(size)
}

// If valid "n" indicates the number of bytes in d that do not contain data. Hence 4 -
bytes := []byte{
byte(ClientIntiateDownload | e | s | ((int(n) << 2) & TransferMaskSize)),
byte(ClientIntiateDownload | e | s | ((4 - (int(n) << 2)) & TransferMaskSize)),
download.ObjectIndex.Index.B0, download.ObjectIndex.Index.B1,
download.ObjectIndex.SubIndex,
}
Expand Down

0 comments on commit 8c9d130

Please sign in to comment.