Skip to content

Commit

Permalink
Merge pull request #167 from OpenEtherCATsociety/fix/download_variabl…
Browse files Browse the repository at this point in the history
…e_using_CA

Fix padding of index 0 for object type variable
  • Loading branch information
nakarlsson authored Feb 5, 2024
2 parents 3fe4511 + 9525469 commit 05bf6c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions soes/esc_coe.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,11 @@ static uint32_t complete_access_subindex_loop(const _objd *objd,
}
}

/* Subindex 0 is padded to 16 bit */
size += (nsub == 0) ? 16 : bitlen;
/* Subindex 0 is padded to 16 bit if not object type VARIABLE.
* For VARIABLE use true bitsize.
*/
size +=
((nsub == 0) && (SDOobjects[nidx].objtype != OTYPE_VAR)) ? 16 : bitlen;
nsub++;

if ((max_bytes > 0) && (BITS2BYTES(size) >= max_bytes))
Expand Down

0 comments on commit 05bf6c6

Please sign in to comment.