Fixed segmented sdo dictionary upload (only first segment contains list type)
authorRafael Blank <ch1010866@ch10pc436>
Thu, 24 Feb 2011 10:04:42 +0100
changeset 2041 f5b31f46c38f
parent 2040 45706e3273fd
child 2042 8b358effa78b
child 2044 1ae0491b2f6b
Fixed segmented sdo dictionary upload (only first segment contains list type)
master/fsm_coe.c
--- a/master/fsm_coe.c	Mon Jan 17 11:09:11 2011 +0100
+++ b/master/fsm_coe.c	Thu Feb 24 10:04:42 2011 +0100
@@ -503,10 +503,13 @@
         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;