From 144ac534f6b80bba089440353db19bf33e83e07c Mon Sep 17 00:00:00 2001 From: Rafael Blank Date: Thu, 24 Feb 2011 10:04:42 +0100 Subject: [PATCH] Fixed segmented sdo dictionary upload (only first segment contains list type) --- master/fsm_coe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/master/fsm_coe.c b/master/fsm_coe.c index c0cff97d..1eee5e61 100644 --- a/master/fsm_coe.c +++ b/master/fsm_coe.c @@ -503,10 +503,13 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */) return; } - sdo_count = (rec_size - 8) / 2; + bool first_segment = list_empty(&slave->sdo_dictionary) ? true : false; + size_t index_list_offset = first_segment ? 8 : 6; + + sdo_count = (rec_size - index_list_offset) / 2; for (i = 0; i < sdo_count; i++) { - sdo_index = EC_READ_U16(data + 8 + i * 2); + sdo_index = EC_READ_U16(data + index_list_offset + i * 2); if (!sdo_index) { EC_SLAVE_DBG(slave, 1, "SDO dictionary contains index 0x0000.\n"); continue;