Commit Graph

728 Commits

Author SHA1 Message Date
Ben Nuttall
a2a6fa7341 Merge pull request #558 from RPi-Distro/statusboard2
Add StatusZero and StatusBoard
2017-06-29 23:22:33 +01:00
Dave Jones
a980f3d14b Add py3.6 to supported/tested versions 2017-06-25 22:14:42 +01:00
Dave Jones
1ce80a8151 Try an explicit close on init failure 2017-06-25 21:48:48 +01:00
Dave Jones
53a8200507 Move device construction into dict-comprehension
Shouldn't make any difference to object lifetimes, but makes the
constructor similar to all others (which don't seem to have the same
issue?)
2017-06-25 21:35:58 +01:00
Dave Jones
12cbd5ae09 First stab at correcting object lifetime issue
This is a minimal change which re-orders some bits of CompositeDevice's
constructor to ensure that all exceptions get raised *before* we store a
reference to the contained devices. Hopefully this'll be enough to sort
out 2.x but I'm not sure it will be for pypy (might still require an
explicit close there).
2017-06-25 21:17:55 +01:00
Dave Jones
56f2152daf Change CompositeDevice to reject invalid identifiers
Also updated StatusBoard and StatusZero to reject duplicate identifiers
(namedtuple doesn't pick 'em up because they're passed in a dict and
thus the dups are squashed prior to the call). Added tests for all the
relevant stuff.
2017-06-25 20:44:13 +01:00
Dave Jones
c9857d55ce Fix statusboard tests
No point testing for invalid names (as they're not *really* invalid);
also ensure tests requiring PWM using MockPWMPin
2017-06-23 23:02:58 +01:00
Ben Nuttall
83cf4cada5 Add tests for StatusZero and StatusBoard 2017-06-23 22:59:29 +01:00
Ben Nuttall
8c656e4c4d Remove kwargs from CompositeOutputDevice init 2017-06-23 22:59:29 +01:00
Ben Nuttall
09711f2ea6 Correct order of red/green LEDs 2017-06-23 22:59:29 +01:00
Ben Nuttall
fe987aaa91 Add StatusBoard and StatusZero to docs and device hierarchy 2017-06-23 22:59:29 +01:00
Ben Nuttall
5f0e87766e Small Statusboard corrections from PR review 2017-06-23 22:58:06 +01:00
Ben Nuttall
55e031d72f Add implementation for StatusBoard 2017-06-23 22:58:06 +01:00
Ben Nuttall
be6380f97b Add implementation for StatusZero 2017-06-23 22:58:06 +01:00
Dave Jones
67ead55d74 Change default mock revision to Pi3B 2017-06-23 19:19:52 +01:00
Dave Jones
ef554d896d Fix tests for pinout 2017-06-23 19:02:03 +01:00
Dave Jones
eb175cc129 Fix pinout so it "works" on non-pi platforms
Or doesn't fail in such a brutal manner, anyway...
2017-06-23 18:55:50 +01:00
Ben Nuttall
ac8b5dbc3b Merge pull request #523 from RPi-Distro/docs-updates
Docs updates: add installing, advanced recipes, remote gpio and remote recipes, close #428, close #434, close #520
2017-06-22 22:55:35 +01:00
Ben Nuttall
36709d6f91 Merge branch 'master' into docs-updates 2017-06-22 22:55:17 +01:00
Dave Jones
a99e0746c3 Fix #279
Permit replacement of pin_factory without closing old factory. However,
continue closing devices associated with extant pin factory at script
termination.
2017-06-22 22:45:00 +01:00
Dave Jones
6e71f20aa6 Merge pull request #469 from waveform80/doc-chart-updates
Update all hierarchy charts in the docs (re #451)
2017-06-22 14:01:05 +01:00
Dave Jones
f8f810a912 Add a little script to generate class graphs
Heavily based on @lurch's efforts in #469 but with some additional
filtering capabilities.
2017-06-22 13:52:00 +01:00
Dave Jones
576fced6c4 Update all hierarchy charts in the docs
Added notes on how the abstracts are represented, ensured all the class
hierarchies were up to date, and changed the orientation so the classes
are actually readable in the big chart.
2017-06-21 17:01:13 +01:00
Dave Jones
412ca72066 First stab at #451
This is almost a straight copy'n'paste of picamera's development chapter
with a few minor changes to make it read sensibly for GPIO Zero; it
needs plenty more work to fulfil the goals of #451 but hopefully this'll
act as a reasonable base for people to work on.
2017-06-21 16:12:25 +01:00
Dave Jones
a0e7b63b8f Fix docs for #521 2017-06-21 16:08:21 +01:00
Dave Jones
ffe12362f5 Fix #521
Rename pigpiod module to pigpio
2017-06-21 15:39:50 +01:00
Dave Jones
d2a7c1434a Fix SPI tests when spidev is installed
Doh! SPI tests fail when the spidev package is installed (which it
normally isn't in my virtualenv) because hardware SPI always takes
precedence and the mock SPI stuff only replaces software SPI.
2017-06-21 14:40:52 +01:00
Dave Jones
35f1ff0623 Eliminate compatibility names from tests
No need to run the same tests on the same backends
2017-06-21 14:40:30 +01:00
Dave Jones
1022b0b0de Close #465
Factor out hardware SPI pin numbers; this is a effectively a rebase (and
minor modification) of @lurch's original patch which conflicted after
the merge of the remote-spi branch.
2017-06-20 23:16:59 +01:00
Dave Jones
a10c037f64 Merge pull request #468 from waveform80/remote-spi
Fix #459 - properly support remote SPI with pigpio
2017-06-20 15:11:52 +01:00
Dave Jones
bcc94354ea Fix #553
Ensure SourceMixin descendents shut down the source prior to closing.
Furthermore, make sure devices are closed before pin factory shuts down,
and that pins have a strong reference to their owning factory (to
prevent losing the factory before the pins).
2017-06-20 11:24:17 +01:00
Dave Jones
ab73e857fd Add compatibility names for pin factories 2017-06-19 22:21:50 +01:00
Dave Jones
aa3aa21695 Reference Device directly
Don't go via the instance dict (prevents anyone overriding the
reservations dict or pin_factory at the instance level)
2017-06-16 22:12:16 +01:00
Dave Jones
6017e7d01d Missing import... 2017-06-16 13:28:55 +01:00
Dave Jones
5487124f74 Fix pigpiod SPI conflicts
Wrong classname in the software implementation and for some reason I'd
reverted a change on spi_flags somewhere... Also removed the clause
skipping remote pigpiod tests

Tested this commit with hardware and software SPI remotely - working
nicely
2017-06-16 13:28:55 +01:00
Dave Jones
4944849a30 Debug travis
Mock pin tests aren't skipped locally, but are skipped on Travis;
temporarily adding a reporting flag to find out why...
2017-06-16 13:28:55 +01:00
Dave Jones
e5336c38ce Run all tests on all platforms
Also renamed GPIOZERO_INPUT_PIN to GPIOZERO_TEST_INPUT_PIN, and fixed up
the pigpio factory so it actually raises an exception if the connection
fails and we don't try and control the daemon anymore.
2017-06-16 13:28:55 +01:00
Dave Jones
945bea4e54 Added keyword args to MockFactory.pin
And a few other last minute fixes
2017-06-16 13:28:55 +01:00
Dave Jones
2ecc25f995 Enable all the factory tests
Ooops ...
2017-06-16 13:28:55 +01:00
Dave Jones
f09b5c5c18 Remove some redundant testing bits 2017-06-16 13:28:55 +01:00
Dave Jones
2495939603 Fix real pin tests ... and some other bits
The real pin tests were broken by the new factory stuff. This commit
fixes them up, and fixes up a few other bits besides (like why the
pigpio PWM tests were failing, why RPi.GPIO sometimes segfaulted on PWM
tests, etc.)

It also causes the real pin tests to run against MockPin (thanks to
@lurch for the suggestion!). This required some tweaks to MockPin to
make it emulate physically pulled up pins itself (which in turn
necessitated changing quite a few pin numbers in the main test suite
because we were using 2 and 3 everywhere), and to allow one MockPin to
drive another. Anyway, everything's working now including all the tests
on a Pi (haven't tried RPIO yet, but only because I'm on a Pi3 -
everything else works with overall coverage of 88% :).
2017-06-16 13:28:55 +01:00
Dave Jones
4049ef5094 Work around for longer object lifetimes on pypy
On pypy the subordinate LED objects in RGBLED composite objects do die
on failed construction ... eventually. Unfortunately it's not quick
enough to prevent the following tests from failing. As we can't know for
certain exactly which test is going to follow, it's best to simply clear
down the reservation table before each test.
2017-06-16 13:28:55 +01:00
Dave Jones
d3c55d25a4 Tidying up...
Dunno how many commits this PR is now!
2017-06-16 13:28:55 +01:00
Dave Jones
b59af7a08f Remove py2 incompatible raise in WeakMethod backport 2017-06-16 13:28:55 +01:00
Dave Jones
73c0516a28 Try and import the right compat...
And remove all the nonsense you re-factored into PiPin...
2017-06-16 13:28:55 +01:00
Dave Jones
cab6cc8086 Rework when_changed attribute to use weakrefs
Some fairly major changes to ensure that the Pin.when_changed property
doesn't keep references to the objects owning the callbacks that are
assigned. This is vaguely tricky given that ordinary weakref's can't be
used with bound methods (which are ephemeral), so I've back-ported
weakref.WeakMethod from Py3.4.

This solves a whole pile of things like Button instances not
disappearing when they're deleted, and makes composite devices
containing Buttons much easier to construct as we don't need to worry
about partially constructed things not getting deleted.
2017-06-16 13:28:55 +01:00
Dave Jones
08076e8d0e Inline the SPI hardware args (neater code) 2017-06-16 13:28:55 +01:00
Dave Jones
15d2c860d3 Use with in a few more tests 2017-06-16 13:28:55 +01:00
Dave Jones
cbff81f3a1 Simplify SPI bit-banging implementation
And add some comments to make stuff clearer
2017-06-16 13:28:55 +01:00
Dave Jones
a9f9aa4a3e Catch SPI conflicts properly
Also handle SPI flags in pigpio implementation more elegantly (just
store the flags and manipulate them instead of keeping separate fields)
2017-06-16 13:28:55 +01:00