Make tests work reliably on the Pi

While the tests work well on a PC or Travis, the Pi (where I ought to be
running them!) has some issues with the timing tests. Need to relax the
tolerance of the "assert_states_and_times" method to 0.05 seconds
otherwise it periodically fails even on something reasonably quick like
a Pi 2 (less failures on a Pi 3 but still occasionally).

Also reduced default fps to 25; if the default timing occasionally fails
on a Pi 2 it's evidently too fast for a Pi 1 and shouldn't be the
default; 25 also doesn't look any different to me on a pulsing LED.

There's also a bunch of miscellaneous fixes in here; last minute typos
and chart re-gens for the 1.2 release.
This commit is contained in:
Dave Jones
2016-04-08 11:10:59 +01:00
parent 44422bd6c9
commit c2a9392ea5
28 changed files with 846 additions and 842 deletions

56
docs/api_tools.rst Normal file
View File

@@ -0,0 +1,56 @@
============
Source Tools
============
.. currentmodule:: gpiozero.tools
GPIO Zero includes several utility routines which are intended to be used with
the :attr:`~gpiozero.SourceMixin.source` and
:attr:`~gpiozero.ValuesMixin.values` attributes common to most devices in the
library. These utility routines are in the ``tools`` module of GPIO Zero and
are typically imported as follows::
from gpiozero.tools import scaled, negated, conjunction
Given that :attr:`~gpiozero.SourceMixin.source` and
:attr:`~gpiozero.ValuesMixin.values` deal with infinite iterators, another
excellent source of utilities is the :mod:`itertools` module in the standard
library.
Single source conversions
=========================
.. autofunction:: negated
.. autofunction:: inverted
.. autofunction:: scaled
.. autofunction:: clamped
.. autofunction:: post_delayed
.. autofunction:: pre_delayed
.. autofunction:: quantized
.. autofunction:: queued
Combining sources
=================
.. autofunction:: conjunction
.. autofunction:: disjunction
.. autofunction:: averaged
Artifical sources
=================
.. autofunction:: random_values
.. autofunction:: sin_values
.. autofunction:: cos_values