Skip to content

Commit b2ef201

Browse files
authored
Small change in NMT log message and FIXME comment for DS402. (#260)
* nmt: Include node ID in state change message. These log messages can get rather confusing with more nodes involved. * p402: Add FIXME about the messed up logic in reset_from_fault(). That method does not work as intended. Until a fix is ready, at least explain what goes wrong in a code comment.
1 parent 7c5e4ce commit b2ef201

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

canopen/nmt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def send_command(self, code):
6868
"""
6969
if code in COMMAND_TO_STATE:
7070
new_state = COMMAND_TO_STATE[code]
71-
logger.info("Changing NMT state from %s to %s",
72-
NMT_STATES[self._state], NMT_STATES[new_state])
71+
logger.info("Changing NMT state on node %d from %s to %s",
72+
self.id, NMT_STATES[self._state], NMT_STATES[new_state])
7373
self._state = new_state
7474

7575
@property

canopen/profiles/p402.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ def reset_from_fault(self):
287287
if self.state == 'FAULT':
288288
# Resets the Fault Reset bit (rising edge 0 -> 1)
289289
self.controlword = State402.CW_DISABLE_VOLTAGE
290+
# FIXME! The rising edge happens with the transitions toward OPERATION
291+
# ENABLED below, but until then the loop will always reach the timeout!
290292
timeout = time.monotonic() + self.TIMEOUT_RESET_FAULT
291293
while self.is_faulted():
292294
if time.monotonic() > timeout:

0 commit comments

Comments
 (0)