Skip to content

Commit dd36df0

Browse files
committed
bricks/ev3dev: use dedicated reflection mode
REF-RAW was giving too much variation
1 parent d85e2a8 commit dd36df0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bricks/ev3dev/modules/pybricks/ev3devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def reflection(self):
8686
float -- Reflection, ranging from 0.0 (no reflection) to 100.0 (high reflection).
8787
8888
"""
89-
self._mode('REF-RAW')
90-
return round(max(0, min(self._value(0)*-0.2965+193.6, 100)), 1)
89+
self._mode('COL-REFLECT')
90+
return self._value(0)
9191

9292
def rgb(self):
9393
"""Measure the reflection of a surface (using a red, green, and blue light, each measured in turn).

lib/fake-pybricks/pybricks/ev3devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def reflection(self):
331331
"""Measure the reflection of a surface using a red light.
332332
333333
Returns:
334-
:ref:`percentage`: Reflection, ranging from 0.0 (no reflection) to 100.0 (high reflection).
334+
:ref:`percentage`: Reflection, ranging from 0 (no reflection) to 100 (high reflection).
335335
336336
"""
337337
pass

0 commit comments

Comments
 (0)