Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SdoWrite在写入sdoSubIndex=0,且只有一个值需要写入时的bug #84

Open
m819895641 opened this issue Nov 30, 2024 · 0 comments

Comments

@m819895641
Copy link

在soem_wrapper.c的SdoWrite函数中,如果sdoSubIndex == 0,且datasetCount==1,那此时只写入了&null,然后直接return了
else // legacy access
{
int offset = 0;

    if (sdoSubIndex == 0) // sdoSubIndex == 0
    {
        returnValue += ecx_SDOwrite(context, slaveIndex, sdoIndex, 0, FALSE, byteCountSet[0], &null, timeout);
        offset += byteCountSet[0];

        for (uint32 i = 1; i < datasetCount; i++)
        {
            returnValue += ecx_SDOwrite(context, slaveIndex, sdoIndex, i, FALSE, byteCountSet[i], &dataset[offset], timeout);
            offset += byteCountSet[i];
        }

        if (datasetCount > 1)
        {
            returnValue += ecx_SDOwrite(context, slaveIndex, sdoIndex, 0, FALSE, byteCountSet[0], &dataset[0], timeout);

            return returnValue == datasetCount + 1 ? 1 : 0;
        }
    }
    else // random access
    {
        for (uint32 i = 0; i < datasetCount; i++)
        {
            returnValue += ecx_SDOwrite(context, slaveIndex, sdoIndex, i + sdoSubIndex, FALSE, byteCountSet[i], &dataset[i], timeout);
        }
    }

    return returnValue == datasetCount ? 1 : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant