Skip to content

Commit a230742

Browse files
author
Daniel Udd
committed
Fix SDO cached status
The cached field of the SDO job was never cleared which would cause downloads of large objects to always fail once a small object had been downloaded.
1 parent d8c5af0 commit a230742

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/co_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ int co_sdo_read (
277277
job->sdo.subindex = subindex;
278278
job->sdo.data = data;
279279
job->sdo.remain = size;
280+
job->sdo.cached = false;
280281
job->callback = co_job_callback;
281282
job->timestamp = os_tick_current();
282283
job->type = CO_JOB_SDO_READ;
@@ -306,6 +307,7 @@ int co_sdo_write (
306307
job->sdo.subindex = subindex;
307308
job->sdo.data = (uint8_t *)data;
308309
job->sdo.remain = size;
310+
job->sdo.cached = false;
309311
job->callback = co_job_callback;
310312
job->timestamp = os_tick_current();
311313
job->type = CO_JOB_SDO_WRITE;

src/co_sdo_server.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ static int co_sdo_rx_upload_init_req (
129129
job->type = CO_JOB_SDO_UPLOAD;
130130
job->sdo.index = co_fetch_uint16 (&data[1]);
131131
job->sdo.subindex = data[3];
132+
job->sdo.cached = false;
132133
job->timestamp = os_tick_current();
133134

134135
/* Find requested object */
@@ -306,6 +307,7 @@ static int co_sdo_rx_download_init_req (
306307
job->type = CO_JOB_SDO_DOWNLOAD;
307308
job->sdo.index = co_fetch_uint16 (&data[1]);
308309
job->sdo.subindex = data[3];
310+
job->sdo.cached = false;
309311
job->timestamp = os_tick_current();
310312

311313
/* Find requested object */

test/test_sdo_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ TEST_F (SdoClientTest, ExpeditedUpload)
5858

5959
TEST_F (SdoClientTest, ExpeditedDownload)
6060
{
61-
co_job_t job;
61+
co_job_t job{};
6262
uint16_t value = 0;
6363

6464
uint8_t expected[][8] = {
@@ -136,7 +136,7 @@ TEST_F (SdoClientTest, SegmentedUpload)
136136

137137
TEST_F (SdoClientTest, SegmentedDownload)
138138
{
139-
co_job_t job;
139+
co_job_t job{};
140140
const char * s = "hello world";
141141

142142
uint8_t expected[][8] = {

0 commit comments

Comments
 (0)