Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python-ev3dev2 (2.0.0~beta3) stable; urgency=medium

* wait_until_not_moving should consider "running holding" as "not moving"
Comment thread
dwalton76 marked this conversation as resolved.
Resolved
* brickpi(3) raise exception if LargeMotor not used for a motor
* MoveJoyStick should use SpeedPercent
* renamed GyroSensor rate_and_angle to angle_and_rate
Expand Down
15 changes: 10 additions & 5 deletions ev3dev2/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,13 @@ def wait(self, cond, timeout=None):

def wait_until_not_moving(self, timeout=None):
"""
Blocks until ``running`` is not in ``self.state`` or ``stalled`` is in
``self.state``. The condition is checked when there is an I/O event
related to the ``state`` attribute. Exits early when ``timeout``
(in milliseconds) is reached.
Blocks until one of the following conditions are met:
- ``running`` is not in ``self.state``
- ``stalled`` is in ``self.state``
- ``holding`` is in ``self.state``
The condition is checked when there is an I/O event related to
the ``state`` attribute. Exits early when ``timeout`` (in
milliseconds) is reached.
Returns ``True`` if the condition is met, and ``False`` if the timeout
is reached.
Expand All @@ -828,7 +831,9 @@ def wait_until_not_moving(self, timeout=None):
m.wait_until_not_moving()
"""
return self.wait(lambda state: self.STATE_RUNNING not in state or self.STATE_STALLED in state, timeout)
return self.wait(
lambda state: self.STATE_RUNNING not in state or self.STATE_STALLED in state or self.STATE_HOLDING in state,
timeout)

def wait_until(self, s, timeout=None):
"""
Expand Down