-
Notifications
You must be signed in to change notification settings - Fork 197
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
Bug fixes, send/receive debug logs and Unsigned 24 support #267
Open
TzviRonen
wants to merge
11
commits into
christiansandberg:master
Choose a base branch
from
TzviRonen:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5141b19
test if callback exist before removing it
TzviRonen 3ce8ab4
Added send message debug log
TzviRonen bc06df4
Added debug logs and pause before read
TzviRonen 3fb146e
fixed get_data var len calc
TzviRonen 659899d
Added Unsigned24 data type
TzviRonen 9b9efb7
Added PyCharm to gitignore
TzviRonen a8fcd87
request_response RETRY_DELAY
TzviRonen d0d9bba
made RETRY_DELAY default zero
TzviRonen b14f43e
removed callback test
TzviRonen 56b206a
fixed uint24 support comments
TzviRonen a108eee
t
TzviRonen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the cached value here seems like a good idea, but it does change the semantics. That should at least be explained in the commit message.
Why not apply the same treatment in
set_data()
? Is there maybe some intentional reasonlen(self.od)
andself.length
are both used in these functions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't think of any reason len (self. OD) is used here.
Somehow len
(self.od)
changed during the program execution and wasn't equal toself.length
whenget_data
was called. It made the returned data to be in the wrong size. Changing it toself.length
fixed the problem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well,
len(self.od)
returns the number of bits (rounded up to full bytes) that the object consists of according to the node's object dictionary, which is constant. Whileself.length
starts off with the same value, it might be overridden when adding theVariable
to a PDO mapping, where you can e.g. specify to map only (the lower) 16 bits of a 32 bit unsigned object. That difference is adjusted inpdo.Map.add_variable()
.I agree there are some corner cases in the code that don't deal well with mapping only some bits of an object. But to fix that properly, each use within
get_data()
andset_data()
should be reconsidered individually. Just changing one instance might fix your problem, but cause issues for other users.By the way, my (hacky) solution so far was to adjust the
ObjectDictionary
instance to artificially overwrite thedata_type
member when using partial objects in PDO mappings. That breaks SDO access though, and doesn't cope well with signed numbers (two's complement requires changing the higher bytes as well when crossing zero).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acolomb This one