Skip to content

Commit d8c5af0

Browse files
author
Daniel Udd
committed
Fix SDO 7B last packet
1 parent 25f8d13 commit d8c5af0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/co_sdo_client.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ static int co_sdo_tx_download_init_rsp (
154154
memcpy (&msg[1], job->sdo.data, size);
155155

156156
msg[0] = CO_SDO_CCS_DOWNLOAD_SEG_REQ | ((7 - (size & 0x07)) << 1);
157-
if (size < 7)
158-
msg[0] |= CO_SDO_C;
159157

160158
job->sdo.toggle = 0;
161-
162159
job->sdo.data += size;
163160
job->sdo.remain -= size;
164161
job->sdo.total += size;
165162

163+
if (job->sdo.remain == 0)
164+
msg[0] |= CO_SDO_C;
165+
166166
os_channel_send (net->channel, 0x600 + node, msg, sizeof (msg));
167167
}
168168

@@ -209,13 +209,14 @@ static int co_sdo_tx_download_seg_rsp (
209209
msg[0] = CO_SDO_CCS_DOWNLOAD_SEG_REQ | ((7 - (size & 0x07)) << 1);
210210
if (job->sdo.toggle)
211211
msg[0] |= CO_SDO_TOGGLE;
212-
if (size < 7)
213-
msg[0] |= CO_SDO_C;
214212

215213
job->sdo.data += size;
216214
job->sdo.remain -= size;
217215
job->sdo.total += size;
218216

217+
if (job->sdo.remain == 0)
218+
msg[0] |= CO_SDO_C;
219+
219220
os_channel_send (net->channel, 0x600 + node, msg, sizeof (msg));
220221
}
221222

0 commit comments

Comments
 (0)