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

Add 'changed' status to varGetValue #1

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sclaiborne
Copy link
Member

@sclaiborne sclaiborne commented Dec 3, 2021

Important notes:

  1. (w)Strings with lengths longer than VAR_STRLEN_NAME (120) chars will only report on change if its in the first 120 chars
  2. This increases the stack size of call by VAR_STRLEN_NAME (120) + UDINT (4) bytes
  3. This increases cpu usage of the call by about 1 strlen (max 120 chars) and 1 strcmp (max 120 chars)

@sclaiborne sclaiborne changed the title Add 'change' status to varGetValue Add 'changed' status to varGetValue Dec 3, 2021


} // switch(DataType) //

// Check for value changed
if( valueStringLen != strlen(ipVariable->value)
|| strcmp( valueString, ipVariable->value )) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this instead be memcmp as we know the string lengths are already the same? I am not sure if that optimization gains us much if anything.

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

Successfully merging this pull request may close these issues.

1 participant