Skip to content

Commit 4b95870

Browse files
authored
ds402: Skip explicit change to SWITCHED ON state. (#249)
The BaseNode402.homing() method tries to enter state SWITCHED ON upon entry. That's unnecessary, the application should handle these transitions. But more importantly, it actually fails in many cases, namely if the previous state is SWITCH ON DISABLED, the default power-up state of most devices. There is an automatic way to reach OPERATION ENABLED over multiple intermediate steps, but the library does not know how to reach SWITCHED ON from any other state than OPERATION ENABLED or READY TO SWITCH ON. In addition, setting the op_mode property will already change to SWITCHED ON only if coming from OPERATION ENABLED (which is usually a good idea to avoid unexpected movement). Note that switching the operation mode to HOMING is actually safe in any power state.
1 parent 6ba36dc commit 4b95870

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

canopen/profiles/p402.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ def homing(self, timeout=TIMEOUT_HOMING_DEFAULT, set_new_home=True):
306306
:rtype: bool
307307
"""
308308
previus_op_mode = self.op_mode
309-
self.state = 'SWITCHED ON'
310309
self.op_mode = 'HOMING'
311310
# The homing process will initialize at operation enabled
312311
self.state = 'OPERATION ENABLED'

0 commit comments

Comments
 (0)