Skip to content

Commit

Permalink
Corrected error in Pixe.blink docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
speratus committed Aug 5, 2019
1 parent 9c20274 commit 6ac9d09
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blinkter/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class BlinktBoard(metaclass=Singleton):
Represents the pimoroni Blinkt! GPIO board. This class is a singleton because in order to ensure threadsafety,
it has to make sure that there are no other instances of it present in the current execution environment.
An instance of this class can be obtained in the following manner:
.. code-block:: python3
An instance of this class can be obtained in the following manner: ::
from blinkter import BlinktBoard
board = BlinktBoard()
"""
Expand Down
31 changes: 31 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. py:currentmodule:: blinkter
API Reference
=============
This page contains all of the basic information about the Blinkter library. You should be able to find the answers to
most question you will have about the library here.

BlinktBoard
-----------
This class is the entry point for accessing the rest of the library.

.. autoclass:: BlinktBoard
:members:

Pixel
-----
Most of Blinkter's features are accessed through this class.

- Easy color setting with the :meth:`~Pixel.black`, :meth:`~Pixel.white`, :meth:`~Pixel.red`, :meth:`~Pixel.green`, and :meth:`~Pixel.blue` methods.
- Custom colors via the :meth:`~Pixel.set_color` method.
- Flashing and blinking using the :meth:`~Pixel.flash`, and the :meth:`~Pixel.start_blink` methods.

.. autoclass:: Pixel
:members:

LED
---
A utility class designed to make certain parameter calls more convenient. It is only necessary to be used in some of
:class:`Pixel`'s methods.

.. autoclass:: LED
:members:
50 changes: 50 additions & 0 deletions docs/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Known Issues
============
The issues listed below are ones which have been discovered but for which there is no immediate fix planned.
They are most likely not bugs. Careful coding may in some cases allow you to avoid some of them, while others may
be unavoidable for the time being.

Although there may be no fixes planned for these issues in the immediate future, that does not mean that they are not
being worked on. At the time of writing, all the issues in this list have planned fixes, but which due to the complexity
of the fixes, work has not yet begun on implementing them.

**NOTE:** This list is separate from the list on `the Github issues <https://github.com/speratus/Blinkter/issues>`_ page.
It's purpose is to provide a list of issues which, while known, are not currently being worked on and the reasoning
for the decision not to work on them. The issues found here may be listed on Github but are not necessarily listed there.
This page may be removed in the future, should the `Github issues <https://github.com/speratus/Blinkter/issues>`_ prove
sufficient.

1. Simultaneous pixel blinking lags noticeably
---------------------------------------------
**Description:** Attempting to cause all the pixels to blink simultaneously results in noticeable lag.

This is issue is unavoidable. Due to the way in which multi-threaded blinking is handled, this issue is currently
unavoidable.

Cause
~~~~~
Thread locking. Each blink thread blocks while it waits for the lock on the :class:`BlinktBoard` to be released. Once
The lock is released, the next thread in line acquires it and draws to to the :class:`BlinktBoard`.

Solution
~~~~~~~~
Do not attempt to blink more than two or three pixels at a time for the time being. There is a probable fix for this
issue in the planning stage, but it is not likely to be implemented soon.

2. Multiple :meth:`Pixel.draw` calls from different interpreters cancel each other out
--------------------------------------------------------------------------------------
**Description:** If two or more interpreters create instances of :class:`BlinktBoard` and draw to the blinkt,
they will overwrite each other such that only the most recent call is displayed.

This issue is unavoidable. The only solution is to ensure that only one interpreter has an instance of :class:`BlinktBoard`
at a time.

Cause
~~~~~
This issue is not caused by a design flaw in ``blinkter``'s code, but in a design flaw in the |blinkt| code. Due to the
way in which |blinkt| writes to the GPIO, this problem will always occur when one has multiple interpreters open.

Solution
~~~~~~~~
As mentioned above, the only workaround to this issue is to make sure that only one interpreter accesses :class:`BlinktBoard`.
There are a couple of possible fixes for this problem but both are complicated and development has begun on neither.

0 comments on commit 6ac9d09

Please sign in to comment.