Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Distance Sensor ... again #719

Merged
merged 1 commit into from Jan 25, 2019

Conversation

Projects
None yet
3 participants
@waveform80
Copy link
Member

waveform80 commented Jan 25, 2019

There's an esoteric edge case in the DistanceSensor; if we miss either a
rising or falling edge the state can persist to the next read. A further
missing edge can result in a huge "over-read". This doesn't affect usage
under pigpio, but under RPi.GPIO (which can miss edges during callbacks)
it's an issue.

Furthermore, the edge case where we return 0 (because we realize we've
missed an edge) harms the overall median when the reflector is very
close to the sensor for long periods. Instead, this patch adjusts the
queue to allow it to "ignore" specified values. When the sensor realizes
it's missed an edge it uses an ignored value which means the sensor's
overall value doesn't suddenly skip to 0.

Fix the Distance Sensor ... again
There's an esoteric edge case in the DistanceSensor; if we miss either a
rising or falling edge the state can persist to the next read. A further
missing edge can result in a huge "over-read". This doesn't affect usage
under pigpio, but under RPi.GPIO (which can miss edges during callbacks)
it's an issue.

Furthermore, the edge case where we return 0 (because we realize we've
missed an edge) harms the overall median when the reflector is very
close to the sensor for long periods. Instead, this patch adjusts the
queue to allow it to "ignore" specified values. When the sensor realizes
it's missed an edge it uses an ignored value which means the sensor's
overall value doesn't suddenly skip to 0.
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 25, 2019

Codecov Report

Merging #719 into master will decrease coverage by 0.02%.
The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #719      +/-   ##
=========================================
- Coverage   74.73%   74.7%   -0.03%     
=========================================
  Files          22      22              
  Lines        4180    4187       +7     
  Branches      603     606       +3     
=========================================
+ Hits         3124    3128       +4     
- Misses        984     986       +2     
- Partials       72      73       +1
Impacted Files Coverage Δ
gpiozero/input_devices.py 83.47% <33.33%> (-0.7%) ⬇️
gpiozero/mixins.py 77.4% <83.33%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c71792d...a2351dc. Read the comment docs.

@bennuttall bennuttall merged commit 5d2ea03 into RPi-Distro:master Jan 25, 2019

1 of 3 checks passed

codecov/patch 53.33% of diff hit (target 74.73%)
Details
codecov/project 74.7% (-0.03%) compared to c71792d
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@waveform80 waveform80 deleted the waveform-computing:fix-distance-again branch Jan 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.