Skip to content

Commit

Permalink
Merge pull request #852 from roberterdin/average-of-motion-sensor-to-…
Browse files Browse the repository at this point in the history
…mean

Change average of MotionSensor to geometric mean instead of median
  • Loading branch information
waveform80 committed Mar 11, 2021
2 parents a405689 + 1b0bfd7 commit dd89d03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gpiozero/input_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from threading import Event, Lock
from itertools import tee
try:
from statistics import median
from statistics import median, mean
except ImportError:
from .compat import median

Expand Down Expand Up @@ -616,7 +616,7 @@ def __init__(
super(MotionSensor, self).__init__(
pin, pull_up=pull_up, active_state=active_state,
threshold=threshold, queue_len=queue_len, sample_wait=1 /
sample_rate, partial=partial, pin_factory=pin_factory)
sample_rate, partial=partial, pin_factory=pin_factory, average=mean)
try:
self._queue.start()
except:
Expand Down

0 comments on commit dd89d03

Please sign in to comment.