Skip to content

Commit 95ccb36

Browse files
authored
wait_until_not_moving should consider 'running holding' as 'not moving' (ev3dev#548)
1 parent efe9a73 commit 95ccb36

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎debian/changelog‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
python-ev3dev2 (2.0.0~beta3) stable; urgency=medium
22

3+
* wait_until_not_moving should consider "running holding" as "not moving"
34
* brickpi(3) raise exception if LargeMotor not used for a motor
45
* MoveJoyStick should use SpeedPercent
56
* renamed GyroSensor rate_and_angle to angle_and_rate

‎ev3dev2/motor.py‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,13 @@ def wait(self, cond, timeout=None):
816816

817817
def wait_until_not_moving(self, timeout=None):
818818
"""
819-
Blocks until ``running`` is not in ``self.state`` or ``stalled`` is in
820-
``self.state``. The condition is checked when there is an I/O event
821-
related to the ``state`` attribute. Exits early when ``timeout``
822-
(in milliseconds) is reached.
819+
Blocks until one of the following conditions are met:
820+
- ``running`` is not in ``self.state``
821+
- ``stalled`` is in ``self.state``
822+
- ``holding`` is in ``self.state``
823+
The condition is checked when there is an I/O event related to
824+
the ``state`` attribute. Exits early when ``timeout`` (in
825+
milliseconds) is reached.
823826
824827
Returns ``True`` if the condition is met, and ``False`` if the timeout
825828
is reached.
@@ -828,7 +831,9 @@ def wait_until_not_moving(self, timeout=None):
828831
829832
m.wait_until_not_moving()
830833
"""
831-
return self.wait(lambda state: self.STATE_RUNNING not in state or self.STATE_STALLED in state, timeout)
834+
return self.wait(
835+
lambda state: self.STATE_RUNNING not in state or self.STATE_STALLED in state or self.STATE_HOLDING in state,
836+
timeout)
832837

833838
def wait_until(self, s, timeout=None):
834839
"""

0 commit comments

Comments
 (0)