From 314a4c0d067b21f161f97f6e0737b87bfcb8866b Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Fri, 7 Oct 2016 08:40:24 +0200
Subject: [PATCH] Solved some bugs in the dynamixel v2 sync write command.
 Updated the number of EEPROM variables.

---
 include/eeprom.h     | 2 +-
 src/motion_manager.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/eeprom.h b/include/eeprom.h
index 6ae5309..c200358 100755
--- a/include/eeprom.h
+++ b/include/eeprom.h
@@ -83,7 +83,7 @@ extern "C" {
 #define PAGE_FULL             ((uint8_t)0x80)
 
 /* Variables' number */
-#define NB_OF_VAR             ((uint8_t)0x54)
+#define NB_OF_VAR             ((uint8_t)0x60)
 
 /* Exported types ------------------------------------------------------------*/
 /* Exported macro ------------------------------------------------------------*/
diff --git a/src/motion_manager.c b/src/motion_manager.c
index 8077fcd..6a5e3f1 100755
--- a/src/motion_manager.c
+++ b/src/motion_manager.c
@@ -58,12 +58,12 @@ void manager_send_motion_command(void)
     {
       servo_ids[num]=manager_servos[i].id;
       manager_servos[i].ccw_comp=(1<<(manager_current_slopes[i]&0x0F));
-      write_data[num].data_addr=(uint8_t *)&(manager_servos[i].cw_comp);
+      write_data[num].data_addr=(uint8_t *)&(manager_servos[i].ccw_comp);
       num++;
     }
   }
   if(num>0)
-    dyn_master_sync_write(&darwin_dyn_master_v2,num,servo_ids,P_CW_COMPLIANCE_SLOPE,3,write_data);
+    dyn_master_sync_write(&darwin_dyn_master_v2,num,servo_ids,XL_P_GAIN,3,write_data);
 }
 
 inline uint16_t manager_angle_to_value(uint8_t servo_id,int16_t angle)
@@ -295,7 +295,7 @@ void manager_init(uint16_t period_us)
       // set the action current angles
       manager_current_angles[i]=manager_servos[i].current_angle<<9;
       manager_num_servos++;
-      current=0;
+      current++;
     }
     else
     {
-- 
GitLab