Commit Graph

56 Commits

Author SHA1 Message Date
Andrew Scheller
fc54667f34 More small tidyups
- switch to using sys.exit instead of exit
 - always exit with error-code 1
 - don't bother testing error-codes
 - documentation wording tweak
2016-12-18 03:33:50 +00:00
Ben Nuttall
117e4f5972 Use from to import rather than rename 2016-12-06 13:39:16 +00:00
Ben Nuttall
6e6c80a9fa Merge branch 'master' of https://github.com/stewartadcock/python-gpiozero into stewartadcock-master 2016-12-05 20:56:25 +00:00
Stewart
48d7924395 Fix import in tests 2016-11-07 22:46:46 +00:00
Stewart
726e861238 Add pinout command-line tool 2016-11-07 22:09:59 +00:00
Andrew Scheller
9fbed050ce Add a new alternating_values SourceTool 2016-09-21 16:16:42 +01:00
Dave Jones
9046ea3033 Fix #436
Permit partial, partialmethod, and wraps to be used with event handlers
2016-09-20 11:16:04 +01:00
Ben Nuttall
a79f8ccc16 Merge pull request #446 from lurch/traffic_lights_tweak
Add extra TrafficLight tests, and remove the redundant setattr function
2016-09-19 14:13:51 +01:00
Andrew Scheller
1b3e6a429b Add extra TrafficLight tests, and remove the redundant setattr function
- `CompositeDevice`s can't have any of their attributes set anyway
2016-09-19 12:00:38 +01:00
Andrew Scheller
c35741c793 Add support for the Pi-Stop Traffic-light board 2016-09-19 01:11:29 +01:00
Dave Jones
27c0703043 Fix #354
Actually, "fix" doesn't really do this justice. This is closer to "nukes
from orbit" ...
2016-09-13 17:37:17 +01:00
Dave Jones
737a739cd6 Fix #421
Added SPI tests, simplified the shared SPI software bus implementation,
and fixed several protocol errors in our MCP3xxx classes (the x2 and x1
protocols were wrong)
2016-09-08 22:24:06 +01:00
Dave Jones
02f7d20bc3 Fix #248
Add Servo and AngularServo implementation along with docs and tests.
This is a deliberately minimal implementation designed to be added to as
we agree on new extensions (better than making an all-singing,
all-dancing version in which I get things wrong and then wind up making
backward incompatible changes to get it right :)
2016-08-30 21:33:28 +01:00
Dave Jones
6cc308e44a Fix #354, fix #389
Overhaul the pi_info system:

Pin factories are now capable of generating pi_info themselves (although
currently they all just look up the revision and call pi_info with a
specific one).

PiGPIOPin will now return pi_info for the remote pi which can be
specified by parameter or implicitly by the environment vars.

Overvolted Pis should work properly no matter what (some argument over
whether the revision 7 or 8 chars in this case; both should work). Added
some minor tweaks for the new camera-capable Pi Zero

Finally, added a bunch of tests for pins.data
2016-08-29 11:48:23 +01:00
Andrew Scheller
f96ab609e2 TrafficLights.value also reports 'yellow' instead of 'amber' when appropriate 2016-06-10 12:44:39 +01:00
Andrew Scheller
38262a125f Add 'yellow' as an alias of 'amber' for TrafficLights
Fixes #345
2016-06-10 12:43:22 +01:00
Andrew Scheller
4e58e25bca Revert "Tweak RGBLED tests - increases coverage" 2016-06-10 12:32:37 +01:00
Andrew Scheller
7987f5a786 Tweak RGBLED tests - increases coverage 2016-06-10 12:23:13 +01:00
Andrew Scheller
b3035d306e Add value-setter for Robot class
Fixes #305
2016-05-28 13:50:47 +01:00
Andrew Scheller
e832cfeb23 Add extra init-method params
adds `initial_value` to PiLiter, TrafficLights, PiTraffic & SnowPi and
adds `pwm` to PiTraffic
2016-05-28 12:17:52 +01:00
Andrew Scheller
3a7acbf89d Add LedBorg as a subclass of RGBLED 2016-05-26 20:27:16 +01:00
Dave Jones
92cb735c7f Merge pull request #319 from lurch/test_ledcollection_active_high
Add tests for LEDBoard.active_high and LEDBarGraph.active_high
2016-05-11 16:15:58 +01:00
Andrew Scheller
87d00f9047 Replace Event.wait(0) with Event.is_set()
The functionality is identical, and IMHO the latter is much more readable
2016-05-10 15:03:28 +01:00
Andrew Scheller
eaf0d5ce1e Add tests for LEDBoard.active_high and LEDBarGraph.active_high
Also add LEDBoard.value tests
2016-05-10 11:53:36 +01:00
Dave Jones
c44a4bfe4b Merge pull request #303 from lurch/non_pwmed_motor
Add a `pwm` option to the RGBLED and Motor constructors
2016-05-09 11:52:47 +01:00
Dave Jones
afcec87bab Merge pull request #318 from waveform80/fix-codecov-changes
Mark optional sleeps with no coverage
2016-05-09 11:17:27 +01:00
Dave Jones
fd4075835e Mark optional sleeps with no coverage
Codecov frequently whinges about "unexpected coverage changes" on PRs;
this is because the sleep lines affected sometimes execute and sometimes
don't (they're only there to ensure something exists before we test it).
Hopefully codecov notices the pragmas...
2016-05-09 11:10:31 +01:00
Andrew Scheller
0c2a13367d Tweak test for better coverage report 2016-05-09 00:18:10 +01:00
Andrew Scheller
c9461c50d3 Add a pwm option to the RGBLED and Motor constructors
...along with the other necessary changes required, to allow them to
optionally be used with non-PWM-capable pins
2016-05-08 18:23:30 +01:00
Dave Jones
1575863ba5 Merge pull request #312 from lurch/rgbled_pulse
Add RGBLED.pulse method
2016-05-08 11:53:14 +01:00
Dave Jones
afc847c159 Merge pull request #307 from lurch/extra_board_tests
Add more unit tests, fix a few small bugs
2016-05-08 11:36:27 +01:00
Dave Jones
4d8e49c5b8 Merge pull request #304 from lurch/patch-2
Minor Energenie tweaks
2016-05-08 11:10:38 +01:00
Andrew Scheller
18bb3f559e Add RGBLED.pulse method
Also add timing tests to all the blink unit-tests
2016-05-04 11:14:36 +01:00
Andrew Scheller
fddb95b84b Add more unit tests, fix a few small bugs 2016-04-30 16:47:29 +01:00
Andrew Scheller
864c4f9327 test Energenie repr 2016-04-30 14:12:51 +01:00
Andrew Scheller
28afa63ba8 test tweak 2016-04-30 12:24:05 +01:00
Andrew Scheller
01d5cb928f New source tools: booleanized, pre_periodic_filtered & post_periodic_filtered
Also adds extra parameter validation to the existing source tools, adds input
min and max to inverted, and adds many more source tools unit tests.
2016-04-25 10:41:27 +01:00
Andrew Scheller
9ca4af39de Add extra Source Tools functions: smoothed, summed and multiplied 2016-04-19 22:02:01 +01:00
Dave Jones
79a0fd2a27 Fix #278
Allow the creation of remote pins easily with PiGPIOPin. Also changes
DefaultPin to a pin_factory callable which accepts the input pin number.
2016-04-16 00:30:22 +01:00
Dave Jones
e2b8171bbb Merge pull request #274 from waveform80/doc-reorg
Doc reorganization
2016-04-10 16:58:27 +01:00
Dave Jones
ecc8df8041 Doc reorganization 2016-04-10 16:47:16 +01:00
Andrew Scheller
8e09a077fd Check that the sub-devices of CompositeDevice are actually Device instances 2016-04-10 15:02:34 +01:00
Dave Jones
c2a9392ea5 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.
2016-04-08 23:11:14 +01:00
Dave Jones
dc79671b39 Dsiable control_all test on pypy
Timing too random as usual...
2016-04-06 23:20:55 +01:00
Dave Jones
ee3bd6b532 Fix #204 and start readying the release
Also re-numbers energenie sockets 1-4 (as noted by @bennuttall in
comments to #239), and adds several "real pins" tests and board tests.
The bad-PWM stuff is currently disabled as it causes segfaults when
running the tests and I can't seem to trace the cause at the moment.
Finally, I've tweaked the deb config to suggest gpiozero, removed spidev
as a mandatory dep (which'll fix installs on wheezy for py3), and
there's some more miscellaneous last-minute stuff here that I can't
recall...
2016-04-06 23:06:46 +01:00
Dave Jones
3acf8a0d3a More work on the tests... 2016-04-05 13:22:40 +01:00
Dave Jones
92d80d2ae6 Some more tests... 2016-04-05 02:22:38 +01:00
Dave Jones
b6fb4e4d89 Add "real" pins tests
This is just a quicky for people to start playing with - it's not
complete in any way, shape, or form. This is how I envisage the "real"
pin tests being done; part of the test suite with a `skipif` to ensure
they don't get run on non-Pi platforms, with a fixture to loop over
whatever pin implementations are found (we can't always assume all of
them: for example, RPIO doesn't work on a Pi 2), and a relatively simple
wiring for the test.

In this case I've assumed GPIOs 22 and 27 are wired together. They're
next to each other, so a jumper is sufficient to run the test.

PRs extending the coverage are very welcome (I've already discovered and
fixed several silly bugs in NativePin!). I've left all the interesting
hard stuff for people to play with (PWM testing: statistical sampling?
debounce compensation testing: timing?). When I've got a second, I'll
looking into hooking up my Pi Zero as a Travis-esque test-bed for this,
triggered by GitHub webhooks (not sure how I'll deal with reporting
yet).
2016-02-21 23:16:24 +00:00
Andrew Scheller
741a8ec7f3 More small MockPin tweaks 2016-02-21 01:24:10 +00:00
Andrew Scheller
c0d70f35f6 MockPin improvements
Change MockPin (and MockPWMPin) to make them behave more like 'real' pins - fixes #206
Add new MockPin tests, and rework some of the existing ones
Incorporate #216
2016-02-21 00:35:01 +00:00