diff --git a/CHANGELOG.md b/CHANGELOG.md index 269e7d09..8574268c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## Added - Enabled tilt and orientation config for `MoveHub()`. +- Documented `Motor.close()` ## Fixed - Fixed missing awaitable for `Remote.light` and LWP3 writes. diff --git a/doc/main/pupdevices/motor.rst b/doc/main/pupdevices/motor.rst index 89cbc706..28afaffb 100644 --- a/doc/main/pupdevices/motor.rst +++ b/doc/main/pupdevices/motor.rst @@ -62,6 +62,8 @@ Motors with rotation sensors .. automethod:: pybricks.pupdevices.Motor.settings + .. automethod:: pybricks.pupdevices.Motor.close + .. rubric:: Control settings .. pybricks-requirements:: pybricks-common-control diff --git a/src/pybricks/_common.py b/src/pybricks/_common.py index ddc0b597..4d4b490c 100644 --- a/src/pybricks/_common.py +++ b/src/pybricks/_common.py @@ -605,6 +605,16 @@ def track_target(self, target_angle: Number) -> None: rotate to. """ + def close(self) -> None: + """close() + + Closes the motor object so you can call ``Motor`` again to initialize + a new object. + + This allows advanced users to change properties such as gearing in the + middle of the program, which can be useful for removeable attachments. + """ + class Speaker: """Plays beeps and sounds using a speaker."""