diff options
Diffstat (limited to 'api_layers/protocols')
| -rw-r--r-- | api_layers/protocols/cml.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/api_layers/protocols/cml.py b/api_layers/protocols/cml.py index 113afe7..e085adf 100644 --- a/api_layers/protocols/cml.py +++ b/api_layers/protocols/cml.py @@ -149,6 +149,16 @@ class CMLLayer(BaseProtocol): self._send(motor.address, "]") self._read_reply() elif cmd == "VS": + # Motor must be enabled ("(") or the shaft stays free and + # every move command below is silently accepted but + # produces no motion — see docs/CM1-C_ASCII_Command_ + # Cheatsheet.md "Safety and enable commands". Enabling + # an already-enabled motor is a no-op, so it's safe to + # send unconditionally on every move rather than relying + # on the operator to have pressed a separate M1_ME + # control first. + self._send(motor.address, "(") + self._read_reply() self._send(motor.address, "P0", _CONTINUOUS_POSITION) self._read_reply() self._send(motor.address, "S0", int(value)) @@ -156,6 +166,8 @@ class CMLLayer(BaseProtocol): self._send(motor.address, "^") self._read_reply() elif cmd == "MA": + self._send(motor.address, "(") + self._read_reply() self._send(motor.address, "P0", int(value)) self._read_reply() self._send(motor.address, "^") |
