-
Notifications
You must be signed in to change notification settings - Fork 221
EMCY Error Logging #43
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,18 +22,19 @@ def __init__(self): | |
|
|
||
| def on_emcy(self, can_id, data, timestamp): | ||
| code, register, data = self.EMCY_STRUCT.unpack(data) | ||
| if code & 0xFF == 0: | ||
| entry = EmcyError(code, register, data, timestamp) | ||
|
|
||
| with self.emcy_received: | ||
| self.log.append(entry) | ||
| self.active.append(entry) | ||
| self.emcy_received.notify_all() | ||
|
|
||
| if code & 0xFFFF == 0: | ||
| # Error reset | ||
| self.active = [] | ||
| for callback in self.callbacks: | ||
| callback(None) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking it may be better skip using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. |
||
| else: | ||
| entry = EmcyError(code, register, data, timestamp) | ||
| #print("EMCY received for node %d: %s" % (can_id & 0x7F, entry)) | ||
| with self.emcy_received: | ||
| self.log.append(entry) | ||
| self.active.append(entry) | ||
| self.emcy_received.notify_all() | ||
| for callback in self.callbacks: | ||
| callback(entry) | ||
|
|
||
|
|
||
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 see that I made a mistake masking out the lower byte when I actually meant to mask out the higher byte as specified here for example (reset = 00xx). So I think it should be:
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.
Agreed. Sorry, I did not check DS-301 error codes.