-
Notifications
You must be signed in to change notification settings - Fork 49
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
Various tidyups and support for the BV4626 I/O board #20
Open
coling
wants to merge
18
commits into
zonyl:master
Choose a base branch
from
coling:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The other values (xonxoff and dsrdtr) remain unused but I don't want to mess too much with them. THe serial.Serial device defaults to rtscts=False so this change should make no difference, but some devices like the upcoming BV4626 need this set to True.
It seems that MODEM_PREFIX is not uses, so nuke it. (just trying to tidy up code that confuses me while trying to write a driver for the BV4626)
This removes the _processRegister() method that seems to have either been deprecated or copy/pasted overzealously. None of these methods were called.
When running tests on the BV4626 device, it appears not to initialise correctly the second time it is opened. This is a result of not closing it cleanly when finished, so ensure this is possible. It may make sense to do this automatically on object destruction but I did not want to disrupt other devices that I cannot test
Currently this only supports setting the two relay states but I will add support for configuring and toggling the Digital IO pins and the DAC/ADC in future revisions.
The on/off was so far able to switch the relays on and off but now we can configure which of the 8 general purpose I/O pins are outputs and switch them on/off too.
For some unknown reason, reconnecting for each of the tests doesn't work all that great. Reordering the tests seems to work around this problem.
…r Maplin Wireless Sockets These sockets plug inline into mains outlets and receive a wireless signal to turn them on or off. A trivial reciever module can plug almost directly into the output pins of several receiver boards (e.g. the BV4626 or Ardino, RPi and no doubt others) and via a simple signal control these sockets. This code was partly borrowed from https://github.com/dmcg/raspberry-strogonanoff The above page contains links to the following resources: http://www.maplin.co.uk/remote-controlled-mains-sockets-5-pack-348217 http://proto-pic.co.uk/434mhz-rf-link-transmitter/ http://www.fanjita.org/serendipity/archives/53-Interfacing-with-radio-controlled-mains-sockets-part-2.html
This should avoid writing data to the device when we don't absolutely need to.
This removes old, copy+pasted tests and adds a cleaner instantiation so the options at initialisation do not need to be specified twice. Also adds additional testing for the Maplin Wireless Sockets.
…output pins. Otherwise this does not actually send any signal on the wire.
When testing I usually triggered a connection via some other output pin flip, so there was generally a connection already. However, if there were no other triggers to do the connection, it could be the case that the connection is not alive.
This generally makes them more useful generally and thus can be used by other interfaces more readily.
…ate file. This code is theoretically usable from other interfaces with minimal effort, so split it out to be nice to others who may want to use it.
Oops missed a small bug in the mock test. Seems pull requests automatically update with the branch tho' so the extra couple commits I pushed today should fix that up! |
Just starting to get back into things and ill be pulling this down and reviewing it shortly. Thanks for your patience. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I spoke with you a long time back (more than year I think) about supporting this little I/O board.
I've finally found some time to actually hack on it and have written a small interface driver for it. It's not feature complete and is currently output only, but I do intend to add support for reading input pins (I want to hook up a motion sensor) and the ADC (for a temperature sensor).
With the current code, I also hooked an output pin up to a small RF transmitter that allowed me to switch on/off some wireless sockets sold by Maplin. I've factored this into a helper class that should be usable by other interfaces (e.g. I know it can work on Arduino) too.
While trying to understand the code (my python isn't great), I did a few tidyups along the way that removed dead code.
I think this is OK to merge now, but if you'd rather wait until I finish the input/ADC code or have any other suggestions, that's all fine too!
Cheers!