-
Notifications
You must be signed in to change notification settings - Fork 677
Added TSL2561 directory #139
Conversation
… forum sourced TSL2561 Python code
…'" update from CPP code
…autogain as hack for fixing 16X to 1X not working.
|
Hi Iain, Thanks for doing this - it's just what I was looking for! I have played with your code, and there are a couple bugs and some other Bug #1: The class name has the middle two digits transposed Bug #2: The read8 and read16 methods (functions) call the I2C readS8 and Other minor issues:
|
|
Thanks very much, will update and do another pull request, really appreciated. |
…initions at start of class
|
Tidied up the code so it looks like Python now, just adding some things like throwing an exception for saturation and adding handlers to calling code. |
…cks in example and main method in TSL2561 module
…ot a statement in code
…de with regards saturation detection
|
This is about it for now as don't have the time at moment to go into the deeper issues. |
- Changed Adafruit_I2C.py from a copy to a symbolic link - Added underscore back into class name - Removed unnecessary inheritance from Adafruit_I2C - Removed vestigial trailing */ from comments - Removed (now unnecessary) autogain hack - Fold (most) long lines to comply with col 80 limit - Added BSD license header comment
Add the underscore to the class name in Adafruit_TSL2561_example.py
|
Hi Iain, I forked from the latest version of your fork, and made several You should be able to see the diffs in the pull request. A few of these You also had the following comment before the exception code: "TODO: Fix that exception not raised when hits saturation but returns a Lux of around 780" I removed that comment because I did not observe that problem. I tested
P.S. I am going to be gone for the next 5 days. I may see e-mail but |
Additional cleanup
|
Chris, thanks very much, I've merged your pull request and afaik given you permissions to merge anything into this pull request in the future, you have write permission to my fork and this pull. I'll try the saturation test again which is basically holding a maglite above the sensor until it max's out to see if the hack is needed for me or not. Will let you know what happens. The coding standards were basically from PEP 8 and suing Pycharm & SonarQube but meh am not fussed, it at least looks Pythonish vs C++ now ;) Have a great 5 days away and if I don't hear from you a great x-mas, I'll be available until about the 5th. Would be good to put this sucker to bed. |
|
Hi Iain, Looks like the fork-of-a-fork thing worked. Good to know! Thanks for giving me push permission. That's something else I haven't done before, but I'm sure it's straightforward if I need to use it. It will be interesting to hear what you find when you try the saturation test again. Your test sounds pretty similar to mine. It's easiest to hit the saturation point in the 402ms integration time mode because it happens at a lower lux value, but I was able to hit it in all three modes if I got the light close enough. The exception seemed to work fine. I'm not likely to contribute much more to this since my project is working now, and it was just a personal project anyway. I think the code is in good shape and I hope your pull request is granted. I hope you have a great Christmas as well!
|
|
Will let you know and thanks, will update my code for the dataloop.io interface to use the new class name. Iain |
|
Thank you for the Pull Request Visit https://circuitpython.org/blinka for more information CircuitPython has support for almost 200 different drivers, and a as well as FT232H support for Mac/Win/Linux! |
Pulled together a working and up to date python driver for the TSL2561 Lux sensor.
Has been compared to a 10 UKP Lux meter and was within 10% across the range.