Skip to content

Commit 78c54de

Browse files
WasabiFanddemidov
authored andcommitted
Add warning to documentation about waiting for "stalled" state (#244)
1 parent a62b7b7 commit 78c54de

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

ev3dev/core.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,15 @@ def wait_until(self, s, timeout=None):
843843
Blocks until ``s`` is in ``self.state``. The condition is checked when
844844
there is an I/O event related to the ``state`` attribute. Exits early
845845
when ``timeout`` (in milliseconds) is reached.
846-
846+
847+
**Warning:** In ev3dev kernel release cycles 16 and earlier, there is
848+
a bug which causes the ``state`` attribute to include ``stalled``
849+
immediately after starting the motor even if it is not actually being
850+
prevented from rotating. As a workaround, we recommend sleeping your
851+
code for around 100ms after starting a motor if you are going to use
852+
this method to wait for it to be ``stalled``. A fix for this has not
853+
yet been released.
854+
847855
Returns ``True`` if the condition is met, and ``False`` if the timeout
848856
is reached.
849857
@@ -858,7 +866,15 @@ def wait_while(self, s, timeout=None):
858866
Blocks until ``s`` is not in ``self.state``. The condition is checked
859867
when there is an I/O event related to the ``state`` attribute. Exits
860868
early when ``timeout`` (in milliseconds) is reached.
861-
869+
870+
**Warning:** In ev3dev kernel release cycles 16 and earlier, there is
871+
a bug which causes the ``state`` attribute to include ``stalled``
872+
immediately after starting the motor even if it is not actually being
873+
prevented from rotating. As a workaround, we recommend sleeping your
874+
code for around 100ms after starting a motor if you are going to use
875+
this method to wait for it to be ``stalled``. A fix for this has not
876+
yet been released.
877+
862878
Returns ``True`` if the condition is met, and ``False`` if the timeout
863879
is reached.
864880

0 commit comments

Comments
 (0)