Skip to content

Commit 2918d1c

Browse files
committed
Clarify averaging of queues
We don't actually default to mean anymore for the queues; we use median to eliminate outliers (assuming this isn't overridden). Just state the queues are returning an "average" (which is true regardless of whether the underlying implementation is mean / median).
1 parent db98564 commit 2918d1c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

gpiozero/input_devices.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class LineSensor(SmoothedInputDevice):
487487
internal queue) per second. Defaults to 100.
488488
489489
:param float threshold:
490-
Defaults to 0.5. When the mean of all values in the internal queue
490+
Defaults to 0.5. When the average of all values in the internal queue
491491
rises above this value, the sensor will be considered "active" by the
492492
:attr:`~SmoothedInputDevice.is_active` property, and all appropriate
493493
events will be fired.
@@ -579,7 +579,7 @@ class MotionSensor(SmoothedInputDevice):
579579
internal queue) per second. Defaults to 100.
580580
581581
:param float threshold:
582-
Defaults to 0.5. When the mean of all values in the internal queue
582+
Defaults to 0.5. When the average of all values in the internal queue
583583
rises above this value, the sensor will be considered "active" by the
584584
:attr:`~SmoothedInputDevice.is_active` property, and all appropriate
585585
events will be fired.
@@ -597,7 +597,10 @@ class MotionSensor(SmoothedInputDevice):
597597
598598
.. attribute:: value
599599
600-
Returns 1 if the motion is currently detected, and 0 otherwise.
600+
With the default *queue_len* of 1, this is effectively boolean where 0
601+
means no motion detected and 1 means motion detected. If you specify
602+
a *queue_len* greater than 1, this will be an averaged value where
603+
values closer to 1 imply motion detection.
601604
"""
602605
def __init__(
603606
self, pin=None, pull_up=False, active_state=None, queue_len=1,
@@ -656,7 +659,7 @@ class LightSensor(SmoothedInputDevice):
656659
valued capacitors or LDRs.
657660
658661
:param float threshold:
659-
Defaults to 0.1. When the mean of all values in the internal queue
662+
Defaults to 0.1. When the average of all values in the internal queue
660663
rises above this value, the area will be considered "light", and all
661664
appropriate events will be fired.
662665

0 commit comments

Comments
 (0)