Skip to content

Commit ee49c3c

Browse files
committed
Modify fast_sync_read example
1 parent a7982db commit ee49c3c

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

examples/advanced/fast_sync_read/fast_sync_read.ino

+24-22
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,39 @@
5959
DYNAMIXEL PROTOCOL 1.0 does NOT support Sync Read feature.
6060
Structures containing the necessary information to process the 'fastSyncRead' packet.
6161
62-
typedef struct XELInfoFastSyncRead{
63-
uint8_t *p_recv_buf;
64-
uint8_t id;
65-
uint8_t error;
66-
} __attribute__((packed)) XELInfoFastSyncRead_t;
67-
68-
typedef struct InfoFastSyncReadInst{
69-
uint16_t addr;
70-
uint16_t addr_length;
71-
XELInfoFastSyncRead_t* p_xels;
72-
uint8_t xel_count;
73-
bool is_info_changed;
74-
InfoSyncBulkBuffer_t packet;
75-
} __attribute__((packed)) InfoFastSyncReadInst_t;
62+
struct XELInfoSyncRead_t {
63+
uint8_t *p_recv_buf;
64+
uint8_t id;
65+
uint8_t error;
66+
} __attribute__((packed));
67+
68+
struct InfoSyncReadInst_t {
69+
uint16_t addr;
70+
uint16_t addr_length;
71+
XELInfoSyncRead_t* p_xels;
72+
uint8_t xel_count;
73+
bool is_info_changed;
74+
InfoSyncBulkBuffer_t packet;
75+
} __attribute__((packed));
7676
*/
7777

7878
/* syncWrite
7979
DYNAMIXEL PROTOCOL 1.0 supports Control Table address up to 255.
8080
Structures containing the necessary information to process the 'syncWrite' packet.
8181
82-
typedef struct XELInfoSyncWrite{
82+
struct XELInfoSyncWrite_t {
8383
uint8_t* p_data;
8484
uint8_t id;
85-
} __attribute__((packed)) XELInfoSyncWrite_t;
85+
} __attribute__((packed));
8686
87-
typedef struct InfoSyncWriteInst{
87+
struct InfoSyncWriteInst_t {
8888
uint16_t addr;
8989
uint16_t addr_length;
9090
XELInfoSyncWrite_t* p_xels;
9191
uint8_t xel_count;
9292
bool is_info_changed;
9393
InfoSyncBulkBuffer_t packet;
94-
} __attribute__((packed)) InfoSyncWriteInst_t;
94+
} __attribute__((packed));
9595
*/
9696

9797
const float DYNAMIXEL_PROTOCOL_VERSION = 2.0;
@@ -115,8 +115,8 @@ typedef struct sw_data{
115115

116116

117117
sr_data_t sr_data[DXL_ID_CNT];
118-
DYNAMIXEL::InfoFastSyncReadInst_t sr_infos;
119-
DYNAMIXEL::XELInfoFastSyncRead_t info_xels_sr[DXL_ID_CNT];
118+
DYNAMIXEL::InfoSyncReadInst_t sr_infos;
119+
DYNAMIXEL::XELInfoSyncRead_t info_xels_sr[DXL_ID_CNT];
120120

121121
sw_data_t sw_data[DXL_ID_CNT];
122122
DYNAMIXEL::InfoSyncWriteInst_t sw_infos;
@@ -231,8 +231,10 @@ void loop() {
231231
DEBUG_SERIAL.print("[fastSyncRead] Success, Received ID Count: ");
232232
DEBUG_SERIAL.println(recv_cnt);
233233
for(i=0; i<recv_cnt; i++) {
234-
DEBUG_SERIAL.print(" ID: ");DEBUG_SERIAL.print(sr_infos.p_xels[i].id);
235-
DEBUG_SERIAL.print("\t Present Position: ");DEBUG_SERIAL.println(sr_data[i].present_position);
234+
DEBUG_SERIAL.print(" ID: ");
235+
DEBUG_SERIAL.print(sr_infos.p_xels[i].id);
236+
DEBUG_SERIAL.print("\t Present Position: ");
237+
DEBUG_SERIAL.println(sr_data[i].present_position);
236238
}
237239
} else {
238240
DEBUG_SERIAL.print("[fastSyncRead] Fail, Lib error code: ");

0 commit comments

Comments
 (0)