Add min_color and max_color options
This commit is contained in:
parent
91447fd484
commit
3097e0851f
10
glow.py
10
glow.py
@ -24,6 +24,12 @@ parser.add_argument('-m', '--minimum', type=int, default=0,
|
|||||||
parser.add_argument('-n', '--no_dim', action='store_true', default=False,
|
parser.add_argument('-n', '--no_dim', action='store_true', default=False,
|
||||||
help='Instead of fading out to a dim minimum, only pause at max glow'
|
help='Instead of fading out to a dim minimum, only pause at max glow'
|
||||||
'and then fade to the next random color.')
|
'and then fade to the next random color.')
|
||||||
|
parser.add_argument('-L', '--min_color', type=int, default=0,
|
||||||
|
help='Minimum of the range to select color values from. A higher value will'
|
||||||
|
'make brighter colors. (valid range: 0-255)')
|
||||||
|
parser.add_argument('-H', '--max_color', type=int, default=255,
|
||||||
|
help='Maximum of the range to select color values from. A lower value will'
|
||||||
|
'make dimmer colors. (valid range: 0-255)')
|
||||||
parser.add_argument('-v', '--verbose', action='store_true', default=False,
|
parser.add_argument('-v', '--verbose', action='store_true', default=False,
|
||||||
help='Display debug printouts of the current and target colors at every '
|
help='Display debug printouts of the current and target colors at every '
|
||||||
'sub-interval')
|
'sub-interval')
|
||||||
@ -50,6 +56,8 @@ interval = parser.parse_args().interval
|
|||||||
glow_pause = parser.parse_args().glow_pause
|
glow_pause = parser.parse_args().glow_pause
|
||||||
dim_pause = parser.parse_args().dim_pause
|
dim_pause = parser.parse_args().dim_pause
|
||||||
minimum = parser.parse_args().minimum
|
minimum = parser.parse_args().minimum
|
||||||
|
min_color = parser.parse_args().min_color
|
||||||
|
max_color = parser.parse_args().max_color
|
||||||
no_dim = parser.parse_args().no_dim
|
no_dim = parser.parse_args().no_dim
|
||||||
verbose = parser.parse_args().verbose
|
verbose = parser.parse_args().verbose
|
||||||
if verbose: print "Allocating..."
|
if verbose: print "Allocating..."
|
||||||
@ -177,7 +185,7 @@ spidev.flush()
|
|||||||
|
|
||||||
# Now, glow
|
# Now, glow
|
||||||
while True:
|
while True:
|
||||||
color = tuple([random.randint(0, len(gamma)-1) for x in range(3)])
|
color = tuple([random.randint(min_color, max_color) for x in range(3)])
|
||||||
# Wrap in try/except block for graceful exiting via KeyboardInterrupt
|
# Wrap in try/except block for graceful exiting via KeyboardInterrupt
|
||||||
try:
|
try:
|
||||||
fade_to_color(color, array, gamma, step=step,
|
fade_to_color(color, array, gamma, step=step,
|
||||||
|
Loading…
Reference in New Issue
Block a user