Skip to content
Snippets Groups Projects
Commit 6371de80 authored by Florian Pose's avatar Florian Pose
Browse files

Fixed bug with bit-sized PDOs leading to wrong Sync-Manager sizes.

parent 71613e25
No related branches found
No related tags found
No related merge requests found
......@@ -1508,20 +1508,23 @@ uint16_t ec_slave_calc_eeprom_sync_size(const ec_slave_t *slave,
{
ec_eeprom_pdo_t *pdo;
ec_eeprom_pdo_entry_t *pdo_entry;
uint16_t size;
unsigned int bit_size;
if (sync->length) return sync->length;
size = 0;
bit_size = 0;
list_for_each_entry(pdo, &slave->eeprom_pdos, list) {
if (pdo->sync_manager != sync->index) continue;
list_for_each_entry(pdo_entry, &pdo->entries, list) {
size += pdo_entry->bit_length / 8;
bit_size += pdo_entry->bit_length;
}
}
return size;
if (bit_size % 8) // round up to full bytes
return bit_size / 8 + 1;
else
return bit_size / 8;
}
/******************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment