rtlabs-com / c-open

CANopen stack for embedded devices
http://www.rt-labs.com
Other
79 stars 40 forks source link

Fix PDO mapping with OD_ARRAY entries #64

Closed nattgris closed 8 months ago

nattgris commented 8 months ago

The second entry is returned from co_entry_find(), for array or record objects, when that entry has the OD_ARRAY flag set. So for these objects the mapped entry pointer in the PDO will always point to the same entry regardless of the subindex of the mapping.

Therefore, the PDO packing and unpacking must not consider the subindex field of the mapped entry when storing or fetching the value. Instead it needs to look at the actual mapped subindex to access the correct data.

hefloryd commented 8 months ago

Great, thanks for the fix.