Use callback also when data is NULL

Change-Id: Id75f52772dfb80fc6802a7a9e252e9f3fc2f33f0
pull/80/head
Lars Danielsson 2020-08-07 10:17:06 +02:00
parent bdea958dd5
commit 6eedcb7cdf
1 changed files with 17 additions and 15 deletions

View File

@ -296,26 +296,28 @@ void SDO_upload (void)
/* expedited response i.e. length<=4 bytes */
coeres->command = COE_COMMAND_UPLOADRESPONSE +
COE_SIZE_INDICATOR + COE_EXPEDITED_INDICATOR + dss;
if ((objd + nsub)->data == NULL)
/* convert bits to bytes */
size = BITS2BYTES(size);
void *dataptr = ((objd + nsub)->data) ?
(objd + nsub)->data : (void *)&((objd + nsub)->value);
abort = ESC_upload_pre_objecthandler (index, subindex,
dataptr, size, (objd + nsub)->flags);
if (abort == 0)
{
/* use constant value */
coeres->size = htoel ((objd + nsub)->value);
}
else
{
/* convert bits to bytes */
size = BITS2BYTES(size);
abort = ESC_upload_pre_objecthandler (index, subindex,
(objd + nsub)->data, size, (objd + nsub)->flags);
if (abort == 0)
if ((objd + nsub)->data == NULL)
{
/* use constant value */
coeres->size = htoel ((objd + nsub)->value);
}
else
{
/* use dynamic data */
copy2mbx ((objd + nsub)->data, &(coeres->size), size);
}
else
{
SDO_abort (index, subindex, abort);
}
}
else
{
SDO_abort (index, subindex, abort);
}
}
else