Small Statusboard corrections from PR review

This commit is contained in:
Ben Nuttall
2017-04-28 22:50:34 +01:00
committed by Dave Jones
parent 55e031d72f
commit 5f0e87766e

View File

@@ -826,13 +826,14 @@ class StatusZero(LEDBoard):
(10, 9), (10, 9),
) )
if len(labels) == 0: if len(labels) == 0:
labels = ['one', 'two', 'three'][:len(pins)] labels = ['one', 'two', 'three']
elif len(labels) > len(pins): elif len(labels) > len(pins):
raise ValueError raise ValueError
strips = OrderedDict() strips = OrderedDict()
for index, label in enumerate(labels): for index, label in enumerate(labels):
green, red = pins[index] green, red = pins[index]
strips[label] = LEDBoard(red=red, green=green, **kwargs) strips[label] = LEDBoard(red=red, green=green,
_order=('red', 'green'), **kwargs)
super(StatusZero, self).__init__(_order=strips.keys(), **strips) super(StatusZero, self).__init__(_order=strips.keys(), **strips)
@@ -855,9 +856,8 @@ class StatusBoard(CompositeOutputDevice):
:param str \*labels: :param str \*labels:
Specify the names of the labels you wish to designate the strips to. Specify the names of the labels you wish to designate the strips to.
You can list up to three labels. If no labels are given, three strips You can list up to three labels. If no labels are given, three strips
will be initialised with names 'one', 'two', and 'three'. If some, but will be initialised with names 'one' to 'five'. If some, but not all
not all strips are given labels, any remaining strips will not be strips are given labels, any remaining strips will not be initialised.
initialised.
.. _STATUS: https://thepihut.com/status .. _STATUS: https://thepihut.com/status
""" """
@@ -870,7 +870,7 @@ class StatusBoard(CompositeOutputDevice):
(6, 13, 18), (6, 13, 18),
) )
if len(labels) == 0: if len(labels) == 0:
labels = ['one', 'two', 'three', 'four', 'five'][:len(pins)] labels = ['one', 'two', 'three', 'four', 'five']
elif len(labels) > len(pins): elif len(labels) > len(pins):
raise ValueError raise ValueError
strips = OrderedDict() strips = OrderedDict()
@@ -888,7 +888,6 @@ class SnowPi(LEDBoard):
""" """
Extends :class:`LEDBoard` for the `Ryanteck SnowPi`_ board. Extends :class:`LEDBoard` for the `Ryanteck SnowPi`_ board.
The SnowPi pins are fixed and therefore there's no need to specify them The SnowPi pins are fixed and therefore there's no need to specify them
when constructing this class. The following example turns on the eyes, sets when constructing this class. The following example turns on the eyes, sets
the nose pulsing, and the arms blinking:: the nose pulsing, and the arms blinking::